[Python-ideas] with-statement syntactic quirk

Barry Warsaw barry at python.org
Sun Nov 4 15:32:39 CET 2012


On Nov 02, 2012, at 08:41 AM, Nick Coghlan wrote:

>> Go's "defer" is quite a neat solution for these hassles if anyone's in
>the mood for a time machine discussion.
>>
>> http://golang.org/doc/effective_go.html#defer
>
>Go was one of the reference points for the ExitStack design (it's a large
>part of why the API also supports providing callbacks directly to the exit
>stack, not just as context managers).

Is it fair to say that the difference between Go's defer and ExitStack is that
the latter gives you the opportunity to clean up earlier than at function
exit?

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121104/0c838ebc/attachment.pgp>


More information about the Python-ideas mailing list