nice python solution

Daniel Klein danielk at aracnet.com
Sun Nov 18 20:46:12 EST 2001


Why not assign the most likely value and then test for the other, ie

a = val
if idx = 1:
    b = val

Daniel Klein


On 18 Nov 2001 20:26:06 GMT, Uwe Schmitt <uwe at rocksport.de> wrote:

>Hi,
>
>i there a nice python shortcut for:
>
>    if idx=0:
>       a=val
>    elif idx=1:
>       b=val
>
>???
>I tried
>   (a,b)[idx] = val
>
>but this does not work, i get an error message.
>
>Greetings, Uwe.





More information about the Python-list mailing list