[issue24941] Add classproperty as builtin class

Erik Bray report at bugs.python.org
Wed Aug 26 19:16:18 CEST 2015


Erik Bray added the comment:

A read-only classproperty is fairly trivial to implement in pure Python and has been done.

A good reason to have a classproperty implementation in CPython would be to support settable/deleteable classproperties.  The problem is that can't be done with the descriptor protocol on its own without a custom metaclass.  classproperty would have to somehow be special-cased, perhaps in type_setattro, say.  I don't know if that can just be done lightly.

Otherwise I don't see the advantage of adding a classproperty type to CPython?

----------
nosy: +erik.bray

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24941>
_______________________________________


More information about the Python-bugs-list mailing list