Hello,  consider:

class C:
    @property
    def f(self) -> int:
        return 2

class D(C):
    pass

D().f = 2

Gives:

Traceback (most recent call last):
  File "/home/neil/src/cmm/a.py", line 10, in <module>
    D().f = 2
AttributeError: can't set attribute 'f'

This can be a pain to debug when the property is buried in a base class.  
Would it make sense to mention the reason why the attribute can't be set, 
namely that it's on a property without a setter?

Best,

Neil
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NG3LNNF4LLDUOZS5UQS53HESWRIHHGXI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to