PEP 308: Alternative conditional operator forms

John Roth johnroth at ameritech.net
Mon Feb 10 07:56:00 EST 2003


"Erik Max Francis" <max at alcyone.com> wrote in message
news:3E473E44.3F7EF4CC at alcyone.com...
> David Gausebeck wrote:
>
> > The reason the : makes sense for me is that the syntax here is
> > essentially the same as for 'if', except that this is an expression.
> > To make it even more analogous, it could be
> >
> > ifelse C: x else: y
> ...
> > Why add a new keyword ('otherwise') when an existing one fits
> > perfectly and causes no conflicts?  'else' in this context seems
like
> > a no-brainer.
>
> I'm going to turn that one right around on you.  Why add the new
keyword
> `ifelse'?  Why not use `if'?

Because you've got a major ambiguity if the statement begins
with an "if". That comment is in the PEP.

John Roth
>
> --
>  Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
>  __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
> /  \ She glanced at her watch ... It was 9:23.
> \__/ James Clavell
>     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