In article <[EMAIL PROTECTED]>,
Sion Arrowsmith <[EMAIL PROTECTED]> writes:
|>
|> Actually, there's an almost throw-away mention in
|> http://docs.python.org/ref/descriptor-invocation.html
|> which gives you what you need (although not, I have to say, in an
|> easily digestible form).
Thanks very much.
|> What I've not seen documented anywhere is the:
|> @property
|> def fset(self, value):
|> ...
|> idiom. It's not obvious from the documentation of the property
|> function that it can be used as a decorator like this. (cf.
|> classmethod and staticmethod.)
Most especially since it isn't working very well for me, and I am trying
to track down why. When I run:
class alf :
def pete (self) :
print "Inside pete\n"
b = alf()
b.pete()
class fred :
@property
def joe (self) :
print "Inside /joe\n"
a = fred()
a.joe()
I get:
Inside pete
Inside joe
Traceback (most recent call last):
File "crap.py", line 14, in <module>
a.joe()
TypeError: 'NoneType' object is not callable
VERY weird - I could understand it if I got the error and DIDN'T succeed
in the call ....
Regards,
Nick Maclaren.
--
http://mail.python.org/mailman/listinfo/python-list