Increment Variable Name

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Jan 23 18:06:38 EST 2008


David Brochu <brochu121 at gmail.com> writes:

> I know the length of a list and I want to pass each element of a
> list to a unique variable, thus I want to increment variable names.
> If the list length = 4, i want to have the following variables:
> var1, var2, var3, var4.

This has a very bad code smell. What problem are you trying to solve
by doing this? I strongly suspect there's a better solution.

-- 
 \           "If you do not trust the source do not use this program." |
  `\                              —Microsoft Vista security dialogue |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list