Nick Coghlan wrote: > The second occurrence of "context manager" is meant to say "context": > > This PEP proposes that the protocol used by the with statement be > known as the "context management protocol", and that objects that > implement that protocol be known as "context managers". The term > "context" then encompasses all objects with a __context__() > method that returns a context object. > > 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.
Ah, all is explained by svn blame, with a little help from svn log. When Phillip went through to make the terminology consistent he actually swapped the meanings of "context" (which meant 'has a __context__ method' in the original PEP) and "context manager" (which meant 'has __enter__ and __exit__ methods and a __context__ method that returns self' in the original PEP). I clearly wasn't paying attention when that diff went past on the checkins list, but I'd humbly request that we change it back :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ 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