Message249182
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? |
|
Date |
User |
Action |
Args |
2015-08-26 07:07:04 | guettli | set | recipients:
+ guettli |
2015-08-26 07:07:03 | guettli | set | messageid: <1440572823.94.0.53142388883.issue24941@psf.upfronthosting.co.za> |
2015-08-26 07:07:03 | guettli | link | issue24941 messages |
2015-08-26 07:07:03 | guettli | create | |
|