Given the code sample below, what is the life cycle for bb
in in example 1 and for self.bb
in example 2
Example 1
import B
class A:
def __init__( self ):
bb = B( self )
Example 2
import B
class A:
def __init__( self ):
self.bb = B( self )
Edit:
B is another class and for some reason i found it was not garbage collected in the first example. I looked more carefully in my code and i found out B class created a new class C and gave a ref to one of its methods to that C class. In the end C instantiated a loop back thread to wait for events hence B class instance was still alive even though A class init was done.
Thanks all for your answers.