RFC: Proposal: Deterministic Object Destruction

Ooomzay ooomzay at gmail.com
Sat Mar 3 21:45:22 EST 2018


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.



More information about the Python-list mailing list