On Wednesday, June 10, 2020, at 19:14 -0500, Chris Angelico wrote:

On Wed, Jun 10, 2020 at 10:08 AM Guido van Rossum <gu...@python.org> wrote:
One thing that the PEG parser makes possible in about 20 lines of code is something not entirely different from the old print statement. I have a prototype:

Python 3.10.0a0 (heads/print-statement-dirty:5ed19fcc1a, Jun 9 2020, 16:31:17)
>>> print 2+2
4

But wait, there's more! The same syntax will make it possible to call *any* function:

>>> len "abc"
3
>>>

Or any method:

>>> import sys
>>> sys.getrefcount "abc"
24
>>>


A lot of people have been boo-hissing at this, but would it be
possible to restrict it to just simple or dotted names (you mentioned
that this part is possible), and only at the REPL? ...

I retrained my muscle memory moving from print to print(). I have almost zero use cases of passing end and sep to the function, although I did have a few cases of ending my print statements with a comma. I still think that print makes a better statement than an expression or a function call; YMMV. Okay, enough background.

I, too, thought about the convenience of not having to type the parentheses at the REPL, but then I can't paste my code from the REPL into my program, and that's no good at all.

len("93e8a1b2688b3fc0dc413c182273a14f5dbd39a23d7845d363c5f9b98283ecaaa7a642578afe55442b7a00ae4ce335c7"
... )
96

and I'm having to remember to put that close parenthesis on it, and it doesn't up-arrow correctly, etc, etc. Would be convenient to use the
space syntax there.

Well, yeah, but that 93e8a1b2688b3fc0dc413c182273a14f5dbd39a23d7845d363c5f9b98283ecaaa7a642578afe55442b7a00ae4ce335c7 probably came from your clipboard (and it's still there, or still sitting in a terminal window, or ...), so even if you had to retype/paste the whole thing, it's not too bad.

And who has the time to retrain the "len" muscle memory *not* to type the parentheses? ;-)
_______________________________________________
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/R6WBIQELBQVNV3K5DPKTOS76R3ZAS6FA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to