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 can think of a
lot of situations where I'd be doing something like:

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

It wouldn't be appropriate to use a __future__ import if it isn't
intended to be brought in eventually, but the same kind of mechanism
would be an effective way to introduce this (instead of magically
recognizing a REPL, you just configure it to run the "from
__alternate__ import no_parens_calls" statement).

As a feature, it feels like the sort of thing that everyone's style
guides would frown on, but it'd be very convenient for quickly
scribbling stuff in the REPL.

ChrisA
_______________________________________________
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/IDXVTAYZQN5E5UKAMKEGOJS6VBU7IJUJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to