PEP 308: "then" "else" for deprecating "and" "or" side effects

Sean Ross sross at connectmail.carleton.ca
Fri Feb 14 20:06:32 EST 2003


Actually, he does mean "x when C else y",  not "C when x else y"...

And, while we're here, doesn't that sound nice?

    wear = "jacket" when outside.iscold() else None

I like how the first option you want for 'wear' is seen first, and I like
how a 'when' expression could never
be confused with an 'if' statement, and I like how it reads as an english
sentence, and I like that a
"little language" designer already used it, and that developers using that
language are fine with it.
And, no, the condition is not out of order. And , no, it is not confusing.
And, if you can have 'then', why
not have 'when' instead... 'then', without 'if', makes me look for the 'if'
which  english tells me should have
come before the <condition>.......ah, whatever......

tired-of-tilting-at-windmills-ly-y'rs...

Sean


"Erik Max Francis" <max at alcyone.com> wrote in message
news:3E4D899C.561C9F9B at alcyone.com...
> François Pinard wrote:
>
> > If I translate the keywords of our syntax back to English, it gives:
> >
> >     a when b else c
>
> This doesn't look like a good counter to the `C then x else y' proposal,
> since using `when' as the keyboard would imply the same ordering as the
> original proposal:
>
> x when C else y
>
> as in, "Put a jacket on when it's old cold outside, otherwise [else]
> where what you want."  This form (with the condition in the middle) has
> already been suggested -- in fact, it was one of the first alternatives
> to the first if/else proposal brought up.
>
> Using it to mean
>
> C when x else y
>
> definitely "reads" wrong in English; if you want this form, the `when'
> should be a `then'.
>
> --
>  Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
>  __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
> /  \ You win the victory when you yield to friends.
> \__/ Sophocles
>     Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
>  A personal guide to Quake III Arena.






More information about the Python-list mailing list