The current, alpha 2, documentation insists that objects with __enter__ and __exit__ methods must also define __context__ in such a way that it returns self.
I don't understand why that is necessary. I can understand that it is convenient, in cases where __context__ doesn't need to create a new object each time, but is it *necessary*? Specifically, is there a use case where you need to say "with x" where x is the return value of a __context__ method, or where you call __context__ on something you got from __context__? I can't find one in the PEP or in the code for contextlib... By insisting that things with __enter__ and __exit__ methods must implement __context__, there's a subtype relationship which I *think* means that Nick's insistence that the concepts are distinct, becomes difficult to support. But the terms are so confused now, that I'm utterly unable to frame my objection clearly. Can someone clarify this? Paul. _______________________________________________ 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