On Wed, Aug 5, 2020 at 9:38 AM Marco Sulla Marco.Sulla.Python@gmail.com wrote:
On Wed, 5 Aug 2020 at 13:29, Dominik Vilsmeier email@example.com 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
What would this print?
@print 1, 2, 3
Would we also want to do this?
@print() 1, 2, 3
How about this?
@print(sep="\n") 1, 2, 3
"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler