[Python-ideas] Properties for classes possible?
Joseph Jevnik
joejev at gmail.com
Thu Aug 20 17:35:52 CEST 2015
I think that syntax would be fine, but then `type.__new__` would need to do
something special with that to implement the setter protocol for the types.
On Thu, Aug 20, 2015 at 11:34 AM, Thomas Güttler <
guettliml at thomas-guettler.de> wrote:
> Am 20.08.2015 um 17:27 schrieb Joseph Jevnik:
>
>> How are metaclasses unpythonic? This is one of the more defining features
>> of python. There will be no way to properly
>> implement this without moving the descriptor up to the metaclass. When
>> thinking about metaclasses, it is often best to
>> just think of them as classes and other types as instances.
>>
>
> Yes, metaclasses are a great feature for experts.
>
> For me this syntax is the most readable:
>
> class MyClass:
>> @classproperty
>> def prop(cls):
>> return '42'--
>>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150820/88a3df87/attachment-0001.html>
More information about the Python-ideas
mailing list