Alex Stapleton wrote:
you are setting the variable name in your code (b.varA), not generating the variable name in a string (var = "varA") (dictionary key) at run-time and fetching it from the __dict__ like i was attempting to describe.

Ahh. Well if you just want to get an attribute, I don't see why you wouldn't do it the normal way:


>>> b = Bunch(varA="Hello!")
>>> getattr(b, "varA")
'Hello!'

That's what getattr's for. ;)  No need to go poking around in __dict__.

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

Reply via email to