kay.schluehr at gmx.net
Thu Jun 29 18:41:25 CEST 2006
Nick Maclaren wrote:
> In article <mailman.7542.1151481315.27775.python-list at python.org>,
> Robert Kern <robert.kern at gmail.com> writes:
> |> Nick Maclaren wrote:
> |> > The way that I read it, Python allows only values (and hence types)
> |> > to be immutable, and not class members. The nearest approach to the
> |> > latter is to use the name hiding conventions.
> |> >
> |> > Is that correct?
> |> You can also make properties that don't allow writing.
> |> class Foo(object):
> |> def __init__(self, bar):
> |> self._bar = bar
> |> @property
> |> def bar(self):
> |> return self._bar
> Thanks very much. And, what's more, I have even found its documentation!
> Whatsnew2.2. The 2.4.2 reference is, er, unhelpful.
> One of Python's less-lovable attributes is the inscrutability of its
> documentation :-(
> But you knew that ....
> Nick Maclaren.
When I want to read about descriptors I use Raymond Hettingers "How To"
article which explains the matter quite fine:
More information about the Python-list