[Python-ideas] with None (Was: Re: Enhanced context managers with ContextManagerExit and None)
Serhiy Storchaka
storchaka at gmail.com
Tue Aug 13 21:32:45 CEST 2013
13.08.13 22:23, Serhiy Storchaka написав(ла):
> 13.08.13 20:45, Terry Reedy написав(ла):
>> As I understand the proposal, it is not to actually make None a context
>> manager with __enter__ and __exit__ methods (bad),
>
> Why?
>
>> but to make it a
>> signal to not do the normal calls.
>
> I agree this is a bad idea.
Sorry, I misunderstood you. Skipping the body of the with statement is a
bad idea (because it converts with into other control construction). But
skipping calls of __enter__() and __exit__() methods looks just as an
optimization an implementation detail (at least for None).
More information about the Python-ideas
mailing list