Nick Maclaren wrote:
> 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"
properties dont work properly on old-style classes (lookup 'new-style
classes' on python.org, in the documentation menu), hence the strange
behaviour you observe. Retry the same thing with s/class fred/class
fred(object)/
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list