If I have a class of the following format:
class TestClass:
def __init__(self):
self.value = 0
def getNewObject(self):
return TestClass()
Is there a limitation to the amount of times I can call the function? For example:
obj = TestClass()
obj.getNewObject().getNewObject()
Is there a limitation to how many times I can call getNewObject() on the return value of getNewObject()? If so what factors affect this?
I doubt it. One reason that makes me doubt it is that if we have this function:
And we disassemble it:
We get this:
That’s just repetitions of
LOAD_ATTRfollowed byCALL_FUNCTION. I can’t imagine that that would require much memory or other resources to manage. As such, there is probably no limit.