On Wed, 5 Aug 2020 at 13:29, Dominik Vilsmeier firstname.lastname@example.org wrote:
On 05.08.20 12:40, Greg Ewing wrote:
A considerable number of moons ago, I suggested that
@my_property fred = 42
should expand to
fred = my_property("fred", 42)
The point being to give the descriptor access to the name of the attribute, without having to repeat yourself.
That should be possible by doing `fred = my_property(42)` and defining `__set_name__` on the `my_property` class.
I suppose that what Greg Ewing suggests is a way to define a sort of custom simple statement.
For example, instead of the old print "Hello"
and the "new" print("Hello")
you could write