On 4/24/06, Aahz <[EMAIL PROTECTED]> wrote: > Let's go back to a pseudo-coded with statement: > > with EXPRESSION [as NAME]: > BLOCK > > What happens while BLOCK is being executed? Again, here's what I said > originally: > > EXPRESSION returns a value that the with statement uses to create a > context (a special kind of namespace). The context is used to > execute the BLOCK. The block might end normally, get terminated by > a break or return, or raise an exception. No matter which of those > things happens, the context contains code to clean up after the > block.
I strongly object to your use of the term "namespace" here. The with statement does *not* create a new namespace. Using the term namespace will only confuse people who understand what it means (in Python) -- we have the global namespace, the builtin namespace, the local namespace, classes introduce a new namespace, etc. The with-statement does *not* create a namespace in this sense -- there's no new place where name lookup can take place. In particular, this code prints 42: x = 1 with whatever(doesnt_matter): x = 42 print x -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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