Loop-and-a-half (Re: Curious assignment behaviour)

Steve Holden sholden at holdenweb.com
Fri Oct 12 20:16:00 EDT 2001


"Tim Peters" <tim at zope.com> wrote ...
> [Michael Chermside, on a conditional expression]
> > ...
>
> If people sign off on taking "then" as a new keyword, I think the chances
> are good that we could get
>
>     x = if e1 then e2 else e3
>
> into 2.2b1.  That's the only obvious spelling, hence the only truly
Pythonic
> way to spell it.  Other languages spelling it that way range from Algol-60
> (Guido's first intense language affair) to Haskell.
>
And so perhaps by extension

    x = if e1 then e2 elif e3 then e4 else e5

? Yet again starting to look a little Lispish. Of course, eventually people
will be posting asking us to debug

    x = if if e1 then e2 else e3 then e4 else e5

and similar. But then every language has its abusers <wink>.

> > hoping-that-less-speed-and-more-thinking-leads-to-a-better-design-
> > ly yours,
>
> less-thinking-will-get-there-faster<wink>-ly y'rs  - tim
>
but-there-may-not-be-the-place-you-want-to-get-ly y'rs  - steve





More information about the Python-list mailing list