[Python-Dev] anonymous blocks

Aahz aahz at pythoncraft.com
Fri Apr 22 03:51:21 CEST 2005


On Thu, Apr 21, 2005, Guido van Rossum wrote:
>
> Perhaps the most important lesson we've learned in this thread is that
> the 'with' keyword proposed in PEP 310 is redundant -- the syntax
> could just be
> 
>     [VAR '=']* EXPR ':'
>         BODY
> 
> IOW the regular assignment / expression statement gets an optional
> colon-plus-suite at the end.

Yes, it could.  The question then becomes whether it should.  Because
it's easy to indent Python code when you're not using a block (consider
function calls with lots of args), my opinion is that like the "optional"
colon after ``for`` and ``if``, the resource block *should* have a
keyword.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR


More information about the Python-Dev mailing list