Create object from variable indirect reference?

NickC reply-to at works.fine.invalid
Tue Nov 10 17:03:17 CET 2009

Many thanks for the replies.  getattr() works great:

>>> name='Moon'
>>> m2 = getattr(ephem,name)()
>>> m2.compute(home)
>>> print ephem.localtime(m2.rise_time)
2009-11-11 01:30:36.000002

shows the moon will rise at 1:30am localtime tonight at my home location.



More information about the Python-list mailing list