
On 06/09/2020 05:06 PM, Guido van Rossum 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:
print 2+2 4 print "hello world" hello world
There are downsides too, though. For example, you can't call a method without arguments:
print <built-in function print>
What happens with "print ," ? (Just curious.)
No, it's not April 1st. I am seriously proposing this (but I'll withdraw it if the response is a resounding "boo, hiss"). After all, we currently have a bunch of complexity in the parser just to give a helpful error message to people used to Python 2's print statement:
While I will happily admit that too many parentheses make it hard to read code, for me at least too few is also a problem. Besides the mental speed-bump of a missing parenthesis (that I could possibly get used to) we would then have more exceptions to memorize as to when the outer-pair of parentheses are needed and when they aren't. Here's a line of code from one of my code bases: Path(table._fnxfs_root) / table._fnxfs_path / column.path Would I need that first set of parens? Path table._fnxfs_root / table._fnxfs_path / column.path I don't think the extra mental complexity is worth it, and I certainly don't mind using parentheses with print. -- ~Ethan~