On Wed, 5 Aug 2020 at 13:29, Dominik Vilsmeier <dominik.vilsme...@gmx.de> 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 @print "Hello" _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/4H2JPEDJBAJD7CUPITAI7GECJ5XMUN6X/ Code of Conduct: http://python.org/psf/codeofconduct/