"甜瓜" <[EMAIL PROTECTED]> writes: > Howdy, > I wonder why below does not work. > > a = object() > a.b = 1 # dynamic bind attribute failed... > > To make it correct, we have to create a new class: > class MyClass(object): pass > a = MyClass() > a.b = 1 # OK
It's annoyingly difficult to search for information on this; "python class object type inherit bind attribute" aren't sufficiently distinguishing to know that we're talking about the built-in 'object' type, and inheriting from it. I'm interested to know the answer to your question; thanks for asking it. -- \ "Don't be afraid of missing opportunities. Behind every failure | `\ is an opportunity somebody wishes they had missed." -- Jane | _o__) Wagner, via Lily Tomlin | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list