A nice guide to descriptors
http://users.rcn.com/python/download/Descriptor.htm
--
http://mail.python.org/mailman/listinfo/python-list
At Monday 8/1/2007 21:47, Gerard Brunick wrote:
Consider: A)
>>> class C(object):
... pass
...
>>> def f(*args):
... print args
...
>>> C.f = f
>>> C.f
>>> c=C()
>>> c.f()
(<__main__.C object at 0x04A51170>,)
And B)
>>> del c
>>> C.f = types.MethodType(f, None, C)
>>> C.f
Consider: A)
>>> class C(object):
... pass
...
>>> def f(*args):
... print args
...
>>> C.f = f
>>> C.f
>>> c=C()
>>> c.f()
(<__main__.C object at 0x04A51170>,)
And B)
>>> del c
>>> C.f = types.MethodType(f, None, C)
>>> C.f
>>> c = C()
>>> c.f()
(<__main__.C object at 0