Raymond Hettinger a écrit :
On Aug 22, 5:38 am, Gregor Horvath <[EMAIL PROTECTED]> wrote:
why is this code failing?

class B(object):
     pass

B.testattr = property(lambda s:"hallo")
b = B()
b.testattr = "test"

First, property() only works when attached to classes, not instances.
So the assignment should be:  B.testattr = property(...)

Mmm... You may want to reread the OP code more carefully !-)

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

Reply via email to