Statement local namespaces summary (was Re: python3: 'where' keyword)

Andrey Tatarinov elephantum at
Mon Jan 10 12:13:25 EST 2005

Nick Coghlan wrote:
> Abstract
> --------
>   The proposal is to add the capacity for statement local namespaces to 
> Python. This allows a statement to be placed at the current scope, while 
> the statement's 'setup code' is indented after the statement::
>   <statement> with:
>       <suite>

I think using 'with' keyword can cause some ambiguity. for example I 
would surely try to write

 >>> x = a+b with self:
 >>>     b = member

and using with at the end of block brings more ambiguity:

 >>> stmt1()
 >>> stmt2()
 >>> with self:
 >>>     member = stmt3()

compare to:

 >>> stmt1()
 >>> stmt2()
 >>> with:
 >>>     variable = stmt3()

a way different semantics with just one word added/deleted.

More information about the Python-list mailing list