On Wed, Aug 5, 2020 at 9:38 AM Marco Sulla <marco.sulla.pyt...@gmail.com>
wrote:

> 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"
>

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

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
_______________________________________________
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/ZGOSVCCIFEPXJA75K453BHEW5WEG3WF6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to