[Python-ideas] Should function attributes be properties?
Joel Bender
jjb5 at cornell.edu
Wed May 2 21:37:43 CEST 2007
I was expecting this to work:
class myprop(property):
def __get__(self, obj, cls): print "get", obj, cls
def __set__(self, obj, value): print "set", obj, value
def f(x):
print 'f'
f.p
f.p = myprop()
So it comes out like this:
>>> f(2)
f
get <function f at 0x61270> None
Is this a bug? Or was it not in the scope of what properties would be
used for? Is this PEP material?
Joel
More information about the Python-ideas
mailing list