RFC: Proposal: Deterministic Object Destruction

Chris Angelico rosuav at gmail.com
Sat Mar 3 21:59:56 EST 2018


On Sun, Mar 4, 2018 at 1:45 PM, Ooomzay <ooomzay at gmail.com> wrote:
> On Sunday, 4 March 2018 01:58:02 UTC, Gregory Ewing  wrote:
>> ooomzay wrote:
>> > Well he was not telling you the whole story: RAII works just as well with
>> > heap objects using smart pointers (unique_ptr and friends) which are a closer
>> > analogy to python object references.
>>
>> By that definition, *all* resource management in Python is
>> based on RAII[1].
>
> I think not. Objects may have a close() in their __del__ method as a back-up - but currently this is not guaranteed to be called in a timely fashion. Hence the
> justification for "with" and my proposal to obviate it by actually guaranteeing
> that __del__ is always called in a timely fashion.

This thread is dead. The OP wants to wave a magic wand and say
"__del__ is now guaranteed to be called immediately", without any
explanation - and, from the look of things, without any understanding
- of what that means for the language and the interpreters. Everyone
else is saying "your magic wand is broken". This is not going to go
anywhere.

ChrisA



More information about the Python-list mailing list