Py3K idea: why not drop the colon?

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Nov 9 16:29:39 EST 2006


Michael Hobbs wrote:

> That is, assume that the expression ends at the colon, not at the
> newline. That would make this type of statement possible:
>     if color == red or
>       color == blue or
>       color == green:
>         return 'primary'
> Right now, such a statement would have to be spelled thus:
>     if color == red or \
>       color == blue or \
>       color == green:
>         return 'primary'
> or
>     if (color == red or
>       color == blue or
>       color == green):
>         return 'primary'

What about

if color == red or blue or green:
    return 'primary'

:)

Really, I think it'd be more mess to let the if statement's end only
depend on ":". I think there could arise situations that are messy
to debug. If I need multiple lines I prefer the parentheses.

Regards,


Björn

-- 
BOFH excuse #295:

The Token fell out of the ring. Call us when you find it.




More information about the Python-list mailing list