SomeClassInstance.[attributename]
tattoom at my-deja.com
tattoom at my-deja.com
Mon Nov 6 09:05:00 EST 2000
More information about the Python-list mailing list
Mon Nov 6 09:05:00 EST 2000
- Previous message (by thread): SomeClassInstance.[attributename]
- Next message (by thread): SomeClassInstance.[attributename]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,Please excuse my ignorance...Python does provide a built-in function to check for the existence of an object's attribute: hasattr(object, name)What puzzles me to no end, is the fact one straight (IMHO) corollary to the above functionality doesn't seem to exist (at least I can't find it :-).Namely, the possibility to access an instance's attribute in a 'parameterized' (is that a correct word?) way..e.g. Assume that Foo is an instance of some class:theAttribute = 'fubar'if hasattr(Foo, theAttribute): fubar = Foo.[theAttribute]# Where Foo.[theAttribute] would yield Foo.fubarYou get my point. Is there a way in Python (as elegant and straightforward as this one) to achieve the above?If not, I'd be interested in seeing suggestions on how to implement it.Many TIA= tmk = Sent via Deja.com http://www.deja.com/ Before you buy.
- Previous message (by thread): SomeClassInstance.[attributename]
- Next message (by thread): SomeClassInstance.[attributename]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list