RFC: Proposal: Deterministic Object Destruction

Chris Angelico rosuav at gmail.com
Sun Mar 4 08:46:09 EST 2018


On Mon, Mar 5, 2018 at 12:26 AM, Ooomzay <ooomzay at gmail.com> wrote:
> Well refcounts are definitely "doable": This is how the reference python implementation, CPython, currently manages to comply with this PEP and can
> therefore be used for RAII.
>
> This PEP is an attempt to _guarantee_ this behaviour and make the elegance
> of RAII available to all pythonistas that want it. Without this guarantee
> python is not attractive to applications that must manage non-trivial
> resources reliably.
>
> Aside: I once read somewhere that must have seemed authoritative at the
> time, that CPython _guarantees_ to continue to behave like this - but now the subject is topical again I can find no trace of this guarantee.

That's because there is no such guarantee. In fact, you can probably
find places in the docs where it is specifically stated that you
cannot depend on __del__ for this.

You still haven't said how you're going to cope with reference cycles
- or are you expecting every single decref to do a full cycle check?

ChrisA



More information about the Python-list mailing list