On 03/03/2018 09:02 AM, ooom...@gmail.com wrote:
> I can assure you that RAII does what it says on the tin and is relied on in 
> many critical systems to release resources robustly ... given the 
> pre-requisite deterministic destruction. 

Sure but did you read what Paul Moore wrote?  He said RAII works in C++
because objects are allocated on the *stack* with strict lifetimes and
scopes. They won't ever have cycles and they are guaranteed to be
destroyed no matter what as the stack is unwound.  Python has no
stack-allocated objects.

In C++, Heap-allocated objects must still be managed manually, without
the benefit of RAII, for much of the same reasons as people are giving
here for why RAII is not a good fit for Python.  There are smart pointer
objects that try to give RAII semantics to heap-allocated objects, with
varying degrees of success. In other words there are some limitations.

Python does not have stack-allocated objects, so the same issues that
prevent RAII from automatically applying in C++ to heap objects exist here.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to