On Sat, Feb 20, 2010 at 7:25 PM, Michael Pardee
<python-l...@open-sense.com> wrote:
>
> But what would be "the python way" to accomplish "list of variables"
> functionality?
>

You're looking for namespaces, AKA dicts.

>>> vars = {}
>>> vars['a'] = 1
>>> vars['b'] = 2
>>> mylist = ['a', 'b']
>>> print [vars[i] for i in mylist] # Here's your dereference
[1,2]
>>> vars['a'] = 3
>>> print [vars[i] for i in mylist]
[3,2]


-- 
Jonathan Gardner
jgard...@jonathangardner.net
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to