variable hell

Diez B. Roggisch deets at web.de
Thu Aug 25 09:34:26 EDT 2005


Nx wrote:
>  I am unpacking a list into variables, for some reason they need to be
>  unpacked into variable names like a0,a1,a2....upto aN whatever is
>  in the list.

Explain this "some reason". This smells, and the way to go would be to
use a dict mapping a_n to whatever is in the list - not creating
variables. How do you want to access generated variables anyway -
especially when you don't have the faintest idea how many of them there
are? Obviously there can't be code written based on that.

Regards,

Diez




More information about the Python-list mailing list