Create object from variable indirect reference?

NickC reply-to at works.fine.invalid
Tue Nov 10 11:03:17 EST 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.

Excellent.

-- 
NickC



More information about the Python-list mailing list