Phillip J. Eby wrote: > At 11:41 PM 4/19/2006 +1000, Nick Coghlan wrote: >> Given that naming though, I think contextlib.contextmanager should be >> renamed >> to contextlib.context. > > The name is actually correct under this terminology arrangement. > @contextmanager *returns* a context manager.
That's like saying we should describe the result of calling a generator function as a generator-iterable because it has an __iter__ method. The longer name made sense when "context manager" was the term for the object with __enter__ and __exit__ methods (the way I originally wrote it when updating the PEP after the addition of the __context__ method). While I agree that flipping the terminology the other way around makes sense, it *also* flips the effect of calling a decorated generator function so that what it returns is now appropriately termed a generator-context (since it provides __enter__ and __exit__ methods directly). These contexts are context managers only in the same sense that iterators are also iterables. We shouldn't break the parallels between iterable-iterator and context manager-context without a good reason - and so far I haven't heard one. 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