Is there a better algorithm?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Fri Jan 2 15:58:41 EST 2009


Fuzzyman:

> for i in l:
>    u = None
>    if len(i) == 2:
>       k, v = i
>    else:
>        k, u, v = i

That's the best solution I have seen in this thread so far (but I
suggest to improve indents and use better variable names). In
programming it's generally better to follow the KISS principle.

Bye,
bearophile



More information about the Python-list mailing list