On Fri, May 04, 2018 at 09:56:10PM -0400, Alexander Belopolsky wrote: > This proposal has finally made me realize why I did not > like PEP 572. The strong expression vs. statement dichotomy is one of > the key features that set Python apart from many other languages and > it makes Python programs much easier to understand.
I'm not so sure that the "expression versus statement" dichotomy is as strong or as useful as Alexander says. If it were, we'd be writing much more imperative code, as if it were 1970 and we were using BASIC. Some of the greatest Python successes have been to add expression forms of what used to be purely imperative statements: - comprehensions (for-loops); - ternary if (if...else statement). In addition, we have more overlap between statements and expressions: - an expression form of def (lambda); - a functional form of the import statement (importlib.import_module, before that people used to use __import__(); - expression forms of augmented assignment (ordinary + etc operators), which is a rare case where the expression form came first and the imperative command came afterwards. I may have missed some. Also notable is that Python does not have "procedures" (pure statement callables). We use functions instead, and simply ignore the returned result. If the difference between statements and expressions was really a dichotomy, we would only need One Way to do these things, not two. I also have seen many people disappointed that Python doesn't treat "everything as an expression". The lack of assignment-expressions is a turn-off for some people: https://mail.python.org/pipermail/python-list/2018-May/732890.html See also: https://stackoverflow.com/questions/50090868/why-are-assignments-not-allowed-in-pythons-lambda-expressions -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/