Nick Coghlan asked Marc-Andre Lemburg:
There's clearly something that bothers you about this though, and I'd like to understand what it is. Does the term 'context' carry additional, more specific, connotations for you that I'm simply not taking into account?
To me, a context is much larger than a single object.
That said, I can't think of any better words. It might be worth noting that context managers don't have to control the entire context -- they will often affect only one small facet, and it is OK to nest them if you want to control more than that.
Jim> Nick Coghlan asked Marc-Andre Lemburg: >> There's clearly something that bothers you about this though, >> and I'd like to understand what it is. Does the term 'context' >> carry additional, more specific, connotations for you that I'm >> simply not taking into account? Jim> To me, a context is much larger than a single object.
To me, "the context" can be as small as exactly the subset of the environment that you need to manage to ensure correct behavior of the object(s) being managed. Eg, in quoting in email "preserving context" does not require quoting the whole message referenced in most cases. You only need to quote enough to ensure that the author's intention is conveyed to your readers.
However, a "context manager" need not manage the whole context of the calling module, only those parts the encapsulated code might damage or misinterpret. Continuing with the email quoting example, if I then go on to quote a different part of the same email you did, I don't (in general) have to preserve the context that you did, only that of the part that I quote.
I don't know that that should be convincing to those who have other associations for the word "context", but maybe it's a useful mnemonic and analogy for tutorial writers.
-- School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.