[Python-ideas] Properties for classes possible?

Thomas Güttler guettliml at thomas-guettler.de
Wed Aug 26 09:07:59 CEST 2015


Here is the created issue: http://bugs.python.org/issue24941

Please let me know if something is missing.

Thomas Güttler

Am 24.08.2015 um 19:17 schrieb Terry Reedy:
> On 8/24/2015 6:07 AM, Thomas Güttler wrote:
>>
>>
>> Am 20.08.2015 um 17:29 schrieb Guido van Rossum:
>>> I 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).
>>
>> What's the next step?
>
> Open an issue on the tracker. Quote Guido's message above with list name, date, and thread name -- or pipermail archive
> url. Add python code below, or revision thereof, for someone to translate to C.
>
>> My knowledge of the programming language C is very limited. I am not
>> able to write a
>> patch for CPython.
>>
>> I could write a patch which looks like this:
>>
>> {{{
>> # 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)
>>
>> }}}
>>
>>
>>
>>
>>
>
>

-- 
Thomas Guettler http://www.thomas-guettler.de/


More information about the Python-ideas mailing list