One last PEP308 suggestion

Evan Simpson evan at 4-am.com
Tue Feb 18 10:49:09 EST 2003


Here's my last thought for a PEP308 syntax that meets my criteria:

(? <cond>: <true>, <false> ?)

The '(?' and '?)' are single tokens.  If you're not allergic to the idea 
of an n-way conditional, it allows for:

(? <cond1>: <expr1>, <cond2>: <expr2>, <default> ?)

Its grammar is obviously feasible, it can't be confused with "if", it 
doesn't introduce new keywords, it has no precedence issues, it's only 
four more characters than "C ? t: f", you know what you're getting into 
the moment you see '(?', and it's even easy to see where it ends.

Cheers,

Evan @ 4-am







More information about the Python-list mailing list