type(A) = B, type(B) = C, type(C) = D...?
Can it go further than the function call depth?
def tower(n=100, sofar=type):
class next(sofar):
__metaclass__ = sofar
return tower(n-1, next)
>>> tower(997)
<class '__main__.sofar'>
>>> tower(998)
#...
File "<stdin>", line 3, in tower
RuntimeError: maximum recursion depth exceeded while calling a Python object
Thanks for sharing such a Excellent Blog! We are linking too this particularly great post on our site. Keep up the great writing.
ReplyDeletepython assignment help