At 04:18 PM 4/25/2006 -0700, Guido van Rossum wrote: >But the question remains, >under what circumstances is it convenient to call __context__() >explicit, and pass the result to a with-statement? Oh. I don't know of any; I previously asked the same question myself. I just eventually answered myself with "I don't care; we need to require self-returning __context__ on execution context objects so that the documentation can appear vaguely sane." :) So, I don't know of any non-self-returning use cases for __context__ on an object that has __enter__ and __exit__. In fact, I suspect that we could strengthen the requirements to say that: 1. If you have __enter__ and __exit__, you MUST have a self-returning __context__ 2. If you don't have __enter__ and __exit__, you MUST NOT have a self-returning __context__ #2 is obvious since you can't use the object with "with" otherwise. #1 reflects the fact that it doesn't make any sense to take the context of a context.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4