Hacker News new | past | comments | ask | show | jobs | submit login

From the documentation of the Python 3.3 data model[1]:

> CPython currently uses a reference-counting scheme with (optional) delayed detection of cyclically linked garbage, which collects most objects as soon as they become unreachable, .... Other implementations act differently and CPython may change. Do not depend on immediate finalization of objects when they become unreachable (ex: always close files).

> object.__del__(self) Called when the instance is about to be destroyed. This is also called a destructor. ... It is not guaranteed that __del__() methods are called for objects that still exist when the interpreter exits.

Summary: Don't count on it. Use "with".

[1] http://docs.python.org/3.3/reference/datamodel.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: