PEP 308: Yet another syntax proposal.

Evan Simpson evan at 4-am.com
Fri Feb 14 14:14:17 EST 2003


sismex01 at hebmex.com wrote:
> 	result = when <condition> : <trueval> else <falseval>

Likely response summary: keyword, verbose, colon bad.  english good.

Here's YAASP, just to keep things chaotic:

(? <condition>: <value>, [<condition>: <value>]*, <value> ?)

As in:

sign = (? x > 0: 1, x < 0: -1, 0 ?)

Substitute "else" for "," and "then" for ":" to taste ;-)

Cheers,

Evan @ 4-am







More information about the Python-list mailing list