[Python-ideas] A suggestion for Python 3 vs Python 2
Steven D'Aprano
steve at pearwood.info
Tue Nov 12 12:42:08 CET 2013
On Tue, Nov 12, 2013 at 08:42:57PM +1000, Nick Coghlan wrote:
> A few months ago I came up with a working "call statement" implementation
> that would allow the parens to be omitted from all simple calls, not just
> print: http://bugs.python.org/issue18788
>
> That shows such an approach is technically feasible, but it also makes it
> clear there are major readability issues if the LHS is allowed to be an
> arbitrary expression.
IPython has had this feature for a while:
In [1]: len []
------> len([])
Out[1]: 0
As IPython is attempting to be an interactive shell rather than just a
REPL, that makes a certain amount of sense, but it does lead to some
unfortunate situations:
In [2]: len [] + len []
------> len([] + len [])
------------------------------------------------------------
File "<ipython console>", line 1
len([] + len [])
^
SyntaxError: invalid syntax
--
Steven
More information about the Python-ideas
mailing list