02.07.20 10:12, Greg Ewing пише:
The @property.getter and @property.setter decorators are
clever, but they have the disadvantage that you end up
writing the name of the property no less than 5 times,
all of which have to match.

5 times? How is it?

Thinking there must be a better way, I came up with this:

def Property(name, bases, dict):
     return property(dict.get('get'), dict.get('set'))

It has a problem with pickling (it is solvable).

The larger problem is with using private (double underscored) variables and super().
_______________________________________________
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/S4JP6W7H35CNXWAWNCCWCNMX6RHAZXH3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to