On Tue, Nov 19, 2019, at 07:03, Paul Moore wrote:
> That sounds reasonable, with one proviso. I would *strongly* object to
> calling context managers that conform to the new expectations "well
> behaved", and by contrast implying that those that don't are somehow
> "misbehaving". File objects have been considered as perfectly
> acceptable context managers since the first introduction of context
> managers (so have locks, and zipfile objects, which might also fall
> foul of the new requirements). Suddenly deeming them as "misbehaving"
> is unreasonable.

The problem is that if this model is perfectly okay, then *there's no reason 
for __enter__ to exist at all*. Why doesn't *every* context manager just do 
*everything* in __init__? I think it's clear that something was lost between 
the design and the implementation.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HYFTAW66RC6YQXE2XQLWAMHKW34BLEQ6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to