On Wed, 10 Jun 2020 at 08:30, Steven D'Aprano <steve@pearwood.info> wrote:
Given Python's execution model where we have statements and functions, I think that it is a feature that they have different syntax. If I see words separated by spaces:
import math del spam while condition if obj assert condition
I know that they are special syntactic forms, even if I'm reading code using some new statement I had missed learning about:
# Python 7 code, fallen through a wormhole require thing demand permission spam contacts verb object
I don't think we should give up that nice clean distinction between function calls which always require parens, and statements which don't require parens, merely to add a second way to call functions that saves one char:
Agreed. On Wed, 10 Jun 2020 at 08:47, Serhiy Storchaka <storchaka@gmail.com> wrote:
10.06.20 03:06, Guido van Rossum пише:
No, it's not April 1st. I am seriously proposing this (but I'll withdraw it if the response is a resounding "boo, hiss").
Well you have my "boo, hiss". I like programming languages which have such feature, but they have it from start, it is an integral part of programming culture for these languages, and Python is built on very different (and often opposite) design principles.
Also agreed. There are languages with parenthesis-less function calls. They are typically languages with a strong emphasis and cultural bias for building DSLs using the language. Python, though, has always resisted such "build your own DSL" styles, and any attempt to write code in such a style looks out of place. While it wouldn't be impossible to alter that bias, it would be quite a significant culture shift, and I'd be surprised if it came without pain (I can imagine new libraries written with the intention of being used "DSL style" being awkward to use from "function style" code). On the other hand, paren-less calls *in a REPL* are more common, and probably more comfortable (e.g., things like IPython's magic syntax). Whether this is something that could be implemented *only* in the REPL, I don't know (probably not - things like the `code` module would need to be able to support it as well) but that might be a possibility. It's certainly the only place where I feel that paren-less calls look OK *for Python*. Paul