Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54156

PEP-442 - Python 3.4 and finalizations (__del__)

From Marco Buttu <marco.buttu@gmail.com>
Newsgroups comp.lang.python
Subject PEP-442 - Python 3.4 and finalizations (__del__)
Date 2013-09-14 10:14 +0200
Organization Aioe.org NNTP Server
Message-ID <l115t1$7mm$1@speranza.aioe.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

PEP-442 - Python 3.4 and finalizations (__del__) Marco Buttu <marco.buttu@gmail.com> - 2013-09-14 10:14 +0200
  Re: PEP-442 - Python 3.4 and finalizations (__del__) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-14 09:42 +0000
    Re: PEP-442 - Python 3.4 and finalizations (__del__) Marco Buttu <marco.buttu@gmail.com> - 2013-09-14 12:10 +0200

csiph-web