
On Mon, Feb 28, 2011 at 8:36 AM, Tal Einat <taleinat@gmail.com> wrote:
Unless I misunderstood, this (__with__ or whatever it ends up being called) would be an alternate method of implementing a context manager, so why not just call these "context managers" just like objects with __enter__ and __exit__ are?
Because that's precisely the terminology confusion that got __context__ dropped from PEP 343 in the first place. To make the standard comparison, even iterators and iterables are not the same thing, even though the former are a subset of the latter. In this case, where objects would be expected to implement __with__ or __enter__/__exit__, but never both, the distinction should be kept even more clear. Basically, __with__ should be a context manager factory function, while context managers themselves are still required to implement __enter__/__exit__. Personally, my preference still goes to "objects with an implicit context manager". That said, until someone steps forward to write the PEP and make the case for bringing this idea back *at all*, the detailed terminology discussion is fairly moot. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia