Newbie question

Peter Hansen peter at
Tue Nov 2 15:01:16 CET 2004

Uday wrote:
> My problem is that I need to dynamically generate a unique 
> variable within a for loop in Python. The name of the variable
> should be appended by the index of the loop. 

This is rarely a useful thing to do.  How do you plan to
access the variable in the rest of the code if the name
is generated dynamically?

Usually, people who think they want to do this should be
using a dictionary instead.


More information about the Python-list mailing list