FAQ

Michael Hudson wrote:

Bruce Dawson <bruce_deletethis_dawson at cygnus-software.com> writes:
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__?
I think you're looking for the builtin functions getattr and setattr.

I sure am. Thanks. That's perfect.

How come we never noticed those before? Perhaps because they are global,
and we were looking for member functions. Ah well - we know them now.

Thanks.

Cheers,
M.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 4 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedOct 17, '02 at 5:31a
activeOct 18, '02 at 4:51a
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase