storing variable names in a list before they are used?

John Salerno johnjsal at NOSPAMgmail.com
Sat Sep 30 20:33:35 CEST 2006


John Salerno wrote:

> Here is what I want to do more specifically:

Ok, I'm sure you all get the idea by now, but here's a simpler way to 
look at it:

Instead of

first_name = wx.TextCtrl(self)
last_name = wx.TextCtrl(self)
job_title = wx.TextCtrl(self)
etc.

and subsequently:

sizer.Add(first_name)
sizer.Add(last_name)
sizer.Add(job_title)
etc.

I want to do something like this:

for name in names:
     name = wx.TextCtrl(self)
     sizer.Add(name)

It's just that I don't know how to handle the "name" variable in the 
"names" list.



More information about the Python-list mailing list