On Wed, Aug 16, 2017 at 5:03 PM, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Chris Angelico <ros...@gmail.com> writes: >>objects exist independently of names > > When the object »Example()« loses its name below, > it loses its existence. > > class Example(object): > ... def __init__(self): > ... print( 'initialized' ) > ... def __del__(self): > ... print( 'deleted' ) > ... >>>> a = Example() > initialized >>>> a = 2 > deleted
Try: >>> class Example(object): ... def __init__(self): ... print('initialized') ... def __del__(self): ... print('deleted') ... >>> a = Example() initialized >>> b = [a] >>> a = 2 >>> The object no longer has a name, but it still exists. -- https://mail.python.org/mailman/listinfo/python-list