RFC: Proposal: Deterministic Object Destruction

Chris Angelico rosuav at gmail.com
Sun Mar 4 07:14:05 EST 2018


On Sun, Mar 4, 2018 at 10:37 PM, Ooomzay <ooomzay at gmail.com> wrote:
> Please consider the case of a composite resource: You need to implement
> __enter__, __exit__ and track the open/closed state at every level in
> your component hierarchy - even if some levels hold no resources directly.
>
> This is burdensome, breaks encapsulation, breaks invariance and is error prone
> ...very unpythonic.

Why do you need to? I don't understand your complaint here - can you
give an example of a composite resource that needs this kind of
special management?

ChrisA



More information about the Python-list mailing list