Coincidentally, cython has a custom, deprecated syntax for properties that
is actually pretty similar, and nice:
cdef class Spam:
property cheese:
"A doc string can go here."
def __get__(self):
# This is called when the property is read.
...
def __set__(self, value):
# This is called when the property is written.
...
def __del__(self):
# This is called when the property is deleted.
https://cython.readthedocs.io/en/latest/src/userguide/extension_types.html#properties
I don't think the benefits are worth a core python change, but great minds..
Steve
On Thu, Jul 2, 2020 at 11:42 AM Greg Ewing <[email protected]>
wrote:
> On 2/07/20 9:00 pm, Steven D'Aprano wrote:
>
> > Perhaps Greg meant to say *up to* rather than "no less".
>
> What I said is true for sufficiently small values of 5. :-)
>
> You're right that it depends on how many operations you
> want. For reading and writing it's 3; if you want deleting
> as well it's 5.
>
> But 3 is still a lot less DRY than 1.
>
> --
> Greg
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/4QVMNKAU7UXX6LHWWVYYFFVME3GXYVDW/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/IXZQZT3D2V7LE5EENHBLUBGGI3M4HJUJ/
Code of Conduct: http://python.org/psf/codeofconduct/