Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
YURI PAPINIAN
11,838 Points__round__
Please explain how round work for OOP. I am getting RecursionError: maximum recursion depth exceeded while calling a Python object
YURI PAPINIAN
11,838 Pointsclass NumString:
def __init__(self,value):
self.value = str(value)
def __repr__(self):
return '{}'.format(self.value)
def __str__(self):
return self.value
def __round__(self,n=1):
Basically, I do not understand how round method works.
1 Answer
Steven Parker
243,656 PointsThe the "__round__" method shown here is incomplete. It won't work because it is unfinished.
Are you trying to create this? If this is for a course, it might be more clear if you post a link to the course page you are working with.
Steven Parker
243,656 PointsSteven Parker
243,656 PointsPlease show your code (properly formatted), or make a snapshot of your workspace and post the link to it here.