dynamic variable referencing

Michael Williams mwilliams at mgreg.com
Tue Dec 6 20:13:57 EST 2005


I would RTM, but I'm not sure exactly what to look for.  Basically, I  
need to be able to call a variable dynamically.  Meaning something  
like the following:

			-  I don't want to say     OBJECT.VAR      but rather      OBJECT. 
("string")      and have it retrieve the variable (not the value of  
it) if in fact it exists. . .

The purpose is to create an XML tree myself by means of  OBJECT. 
("string").__setattr(name,value).  I eventually want to be able to  
say     BOOK[0].AUTHOR.FIRSTNAME . . . that kind of thing.  I've seen  
existing libraries, but I'd really rather know how to do it myself.   
Any assistance would be appreciated.


Regards,
Michael



More information about the Python-list mailing list