|
|
|
|
|
by neuland
3434 days ago
|
|
Mis-seeing it as an array makes a lot of sense for the f(x) syntax. That's probably even more true than it would be in a higher level language like python, because you're doing more stuff like that. But for Python3 lambda type hints, I'm reading a definitive comment in PEP 3107 that it isn't supported [0]. Anecdotally, that also jives with what I'm seeing on the REPL. Python 3.6.0 (default, Jan 18 2017, 02:51:38)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing
>>> f = lambda x: int: x * 6
File "<stdin>", line 1
f = lambda x: int: x * 6
^
SyntaxError: invalid syntax
[0] https://www.python.org/dev/peps/pep-3107/#lambda |
|
Not trying to be pedantic here, just illustrating the point that this style of function can collide with future language developments, and confuse users.
Here's someone complaining that PEP 484 doesn't mention the impact of the new syntax on lambda: https://mail.python.org/pipermail/python-dev/2015-April/1397...