Immutability

Sion Arrowsmith siona at chiark.greenend.org.uk
Wed Jun 28 06:46:32 EDT 2006


Nick Maclaren <nmm1 at cus.cam.ac.uk> wrote:
>Georg Brandl <g.brandl-nospam at gmx.net> writes:
>|> [ attributions lost ]
>|> > Thanks very much.  And, what's more, I have even found its documentation!
>|> > Whatsnew2.2.  The 2.4.2 reference is, er, unhelpful.
>|> Is it?
>|> http://docs.python.org/lib/built-in-funcs.html
>|> documents "property" quite well.
>Sigh.  No.  It's terrible.  What it documents is the use of the property
>FUNCTION.  It does not document what properties ARE, and how they interact
>with the rest of the language.  Until you know that, it is so ambiguous
>as to be almost totally useless - and it is THAT information that needs to
>be in the reference manual, but is only in whatsnew2.2.

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).

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.)

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list