Emulating a = x.y and x.y = a, when 'y' is a string

Richard Jones rjones at ekit-inc.com
Thu Oct 17 07:41:43 CEST 2002

On Thu, 17 Oct 2002 3:31 pm, Bruce Dawson wrote:
> I want to do dynamic access to member variables in Python - reading from
> and writing to object member variables based on a member name stored in
> a string. If the member is stored in __dict__ it is easy enough, but
> what if it is emulated with __getattr__, or a property, or
> __getattribute__?

Use the builtin function getattr()  [and setattr() for setting]


More information about the Python-list mailing list