5 Aug
2020
5 Aug
'20
7:28 a.m.
On 05.08.20 12:40, Greg Ewing wrote:
On 5/08/20 9:13 pm, Serhiy Storchaka wrote:
the code can be written as
class Neuron: activation = linear_activation(activation)
I do not see reasons to introduce special syntax for this very specific code.
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. https://docs.python.org/3/reference/datamodel.html#object.__set_name__