[Python-Dev] PEP 343 update (with statement context terminology)

Aahz aahz at pythoncraft.com
Wed Apr 26 01:31:00 CEST 2006


On Tue, Apr 25, 2006, Guido van Rossum wrote:
> On 4/24/06, Aahz <aahz at pythoncraft.com> 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. 

Right -- I've already been chastised for that.  Unless someone has a
better idea, I'm going to call it a "wrapper".
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Argue for your limitations, and sure enough they're yours."  --Richard Bach


More information about the Python-Dev mailing list