[New-bugs-announce] [issue24941] classproperty

Thomas Guettler report at bugs.python.org
Wed Aug 26 09:07:03 CEST 2015


New submission from Thomas Guettler:

Quoting Guido van Rossum Aug 20 2015. Thread "Properties for classes possible?"

https://mail.python.org/pipermail/python-ideas/2015-August/035354.html

{{{
 think it's reasonable to propose @classproperty as a patch to CPython. It
needs to be C code. Not sure about the writable version. The lazy=True part
is not appropriate for th he stdlib (it's just a memoize pattern).
}}}

The solution I use at the moment:

{{{
# From http://stackoverflow.com/a/5192374/633961
class classproperty(object):
    def __init__(self, f):
        self.f = f
    def __get__(self, obj, owner):
        return self.f(owner)
}}}

According to Terry Jan Reedy the next step is to find
someone to translate this to C.

Sorry, my C knowledge is limited. Can anybody help?

----------
messages: 249182
nosy: guettli
priority: normal
severity: normal
status: open
title: classproperty

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


More information about the New-bugs-announce mailing list