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

Bengt Richter bokr at oz.net
Mon May 19 23:25:34 EDT 2003


On Mon, 19 May 2003 13:13:56 -0700, Michael Chermside <mcherm at mcherm.com> wrote:

>
>> 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()
>
Unfortunately the choice in rebinding inside of the do_something_x's
is either local or global, which typically leaves the scope of the
above sandwiched in the middle and unmodifiable by reasonable means.

Regards,
Bengt Richter




More information about the Python-list mailing list