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

Andy Todd andy47 at halfcooked.com
Mon Oct 15 22:15:45 EDT 2001


"Andrew Dalke" <dalke at dalkescientific.com> wrote in 
<9qe49r$4k1$1 at slb3.atl.mindspring.net>:

>Chris Tavares wrote:
>>May I be the first to say - ICK!
>
>I'll second that nomination.
>

And put me down for thirds ...

>It looks ugly, and doesn't solve any problems I have.
>I *like*
>
>  if e1:
>    x = e2
>  else:
>    x = e3

Its the only construct I use in all of the languages I have to code in 
because it is the only one that is common amongst them and also because it 
is the most understandable. Two very good reasons I'd say.

>
[snip examples]

>
>I tried looking through the thread in its various subject names.
>I couldn't figure out what was the driving reason for this idea.
>(Other than as a replacement for C's ?:  ternary operator.)
>Enlightment, anyone?

That is my take as well. Never liked C's ternary operator, never used it. 
Replicating it in Python adds nothing to the language, it does not make 
code cleaner or more efficient and it certainly doesn't make it easier to 
understand.

Not that my vote counts but minus about 20 from me.

>
>                    Andrew
>                    dalke at dalkescientific.com
>

Regards,
Andy
-- 
Content free posts a speciality



More information about the Python-list mailing list