Immutability
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Wed Jun 28 22:21:14 EDT 2006
Georg Brandl a écrit :
> Steve Holden wrote:
>
>
>>>>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.
>>>
>>
>>I can't really agree that "quite good" documentation doesn't refer to
>>the use of property as a decorator. It's obvious that a ncessary upgrade
>>to the docs didn't happen (and we can all understand why, I am sure).
>
>
> In my opinion property isn't really meant to be used as a decorator since
> it's impossible to create a read-write property. The decorator pattern
> doesn't really fit here.
Making an attribute read-only is a common use case for properties, so
using property as a decorator in this case seems quite ok.
More information about the Python-list
mailing list