PEP-442 - Python 3.4 and finalizations (__del__)

Marco Buttu marco.buttu at gmail.com
Sat Sep 14 04:14:27 EDT 2013


Hi all. Will the following code in Python 3.4 print "Goodbye from B()" 
and "Goodbye from A():

class A:
     def __init__(self, a):
         self.a = a
         print('In A.__init__()')
     def __del__(self):
         print('Goodbye from A()')

class B:
     def __init__(self):
         self.b = A(self) # Reference cycle
         print('In B.__init__()')
     def __del__(self):
         print('Goodbye from B()')

b = B()
del b

Regards, Marco

-- 
Marco Buttu



More information about the Python-list mailing list