On Wed, Apr 19, 2006 at 10:00:21PM +1000, Nick Coghlan wrote:
> And the parenthetical comment was completely backwards and should have read:
> 
>   (This means that all context managers are contexts, but not all contexts 
>   are
>    context managers).
> 
> The reason for recommending that context managers should be contexts is 
> similar to the reason that iterators should be iterables - so that doing 
> the __context__() call manually will still give you something that can be 
> used in a with statement.

So the intention is to enable something like:

ctx = lock.__context__()
with ctx:
    ...

Which works as long as people don't try to use the context in two
nested 'with' statements.  Fair enough.  I don't think I'll suggest
doing this in the "What's New", though.  :)

--amk
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to