En Fri, 18 Jun 2010 06:48:34 -0300, someone <petshm...@googlemail.com> escribió:

is it possible to make first attr variable?

some_object.attr.attr

so instead of attr I could use self.foo which has value "attr"

I think you're looking for getattr:
http://docs.python.org/library/functions.html#getattr

name = "spam"
getattr(some_object, name) == some_object.spam == getattr(some_object, "spam")

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to