[Tutor] classproperty: readonly and inheritance - not more needed

Thomas Güttler guettliml at thomas-guettler.de
Thu Apr 20 04:39:57 EDT 2017



Am 19.04.2017 um 11:16 schrieb Steven D'Aprano:
> On Wed, Apr 19, 2017 at 09:28:26AM +0200, Thomas Güttler wrote:
>
> [code for a classproperty]
>
>> Nice, if it is that simple.
>>
>> Is there a reason why this is not in the standard library?
>
> I haven't had a chance to test Peter's classproperty code yet, but I
> don't expect it to be that simple. People have asked for it before, and
> even Guido himself (the inventor of Python) has agreed that if it
> existed he'd use it, but the proposals have (so far) always stumbled on
> two factors:
>
> - there are not a lot of uses for classproperty that ordinary property
>   isn't "good enough" for;
>
> - its hard to get classproperty to work right.

What is "righ"?

In my case a read-only classproperty is enough. Inheritance should be supported.

I don't have a usecase for a setter.

Regards,
   Thomas Güttler


More information about the Tutor mailing list