[Python-Dev] Are property descriptors intended to be immutable?

Guido van Rossum guido at python.org
Sat Feb 7 01:04:22 CET 2009


On Fri, Feb 6, 2009 at 2:44 PM, Curt Hagenlocher <curt at hagenlocher.org> wrote:
> ...because they're not quite :).  Should I file this as a bug report?
> (I get the same results under 2.6 and 3.0.)
>
> PS C:\Program Files (x86)\CCP\EVE> C:\Python25\python.exe
> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> class x(object):
> ...     @property
> ...     def foo(self): return 1
> ...
>>>> inst = x()
>>>> inst.foo
> 1
>>>> x.foo.__init__(lambda self: 2)
>>>> inst.foo
> 2
>>>> ^Z

No, this is just how it works. I hope they aren't documented as immuable?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list