Proposed PEP for a Conditional Expression

Markus Schaber markus at
Mon Sep 17 17:21:03 CEST 2001


Marcin 'Qrczak' Kowalczyk <qrczak at> schrub:

>> ps.  Then attention could be focused on defining a mechanism for
>> general-purpose, unnamed, "in-place" code blocks.  If we had such,
>> we could then create many convenient idioms using functions and
>> methods -- instead of constantly wrangling with new syntactic forms
>> and keywords.
> Yes, but the syntax of explicitly creating such block would be a bit
> annoying if they would have to be created for e.g. loops.

I just remembered my steps in TCL. There, even loops are commands which 
get some unnamed code blocks as arguments (the condition and the body).

Maybe we could do the same, based on indentation instead of {}s.

But I see some problems in handling the if: else: this way, there the 
else: command needs to know the result of the corresponding if: 

"The strength of the Constitution lies entirely in the determination of 
each citizen to defend it. Only if every single citizen feels duty 
bound to do his share in this defense are the constitutional rights 
secure." -- Albert Einstein

More information about the Python-list mailing list