On Mon, Feb 3, 2014 at 4:12 PM, Roy Smith <[email protected]> wrote:
> So, what you're saying is when I delete an object, __del__() has both
> been called and not been called?
>>> class Schrodinger:
def __init__(self):
print("Init!")
>>> print(Schrodinger())
Init!
<__main__.Schrodinger object at 0x02B52570>
At this point, __del__ has indeed both been called and not been
called. However, observing its state will force it to collapse:
>>> class Schrodinger:
def __init__(self):
print("Init!")
def __del__(self):
print("Del!")
>>> print(Schrodinger())
Init!
<__main__.Schrodinger object at 0x02B52830>
Del!
If an object falls off the heap and there's no __del__ method to hear
it, does it call __del__?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list