OT: Re: Just took a look in the perl newsgroup....

Michael Chermside mcherm at mcherm.com
Mon May 19 16:13:56 EDT 2003


> Similarly, some want a ternary operator. I don't know whether you were
> here yet with the PEP-308 discussion, but this lead to countless
> changing .procmailrc's. There is no decision taken yet. 
> 
> The ternary-discussion keeps coming back. The same is true for case, to
> a lesser extent. Maybe a PEP-333 should for once and for ever end this
> discussion, too. 

Be patient on the conditional expression thing (a better term than
"ternary operator"). Guido's been hard at work on 2.3 (clearly a
higher priority) and is currently on vacation. But I don't think
that the "case" statement is a similar issue -- I think you'll only
find people who are new to Python pining for a case statement, since
we already have at least _2_ of them:


    # One simple approach
    if x = 1:
        do_something_1()
    elif x = 2:
        do_something_2()
    elif x = 3:
        do_something_3()


    # Another (very powerful) approach
    do_something = my_func_dict[x]
    do_something()

-- Michael Chermside






More information about the Python-list mailing list