Alex Stapleton wrote:
you can't do

var = "varA"
obj = struct(varA = "Hello")
print obj.var

and expect it to say Hello to you.

The Bunch object from the PEP can take parameters in the same way that dict() and dict.update() can, so this behavior can be supported like:


>>> b = Bunch({"varA":"Hello!"})
>>> b.varA
'Hello!'

or

>>> b = Bunch([("varA", "Hello!")])
>>> b.varA
'Hello!'

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

Reply via email to