How is this not pythonic?
series.apply(x -> x**2)
Compared to..
series.apply(lambda x: x**2)
(x, y) -> x+y, () -> 0, (x) -> x**2 (for single parameter, we can write it without parenthesis like the example above) are pythonic enough to my eyes.
Well, for m eyes, the above is definetellly "perlonic" . it could be "j" before being Pyrhon.
This is Pythonic:
def f1(x, y):
return x + y
def f2():
return 0
def f3(x):
return x ** 2
And it took me a while looking at our example to check it was not really fuction composition with
default parameters, or what.
I mentioned violation of 6 of the first 7 phrases in the famous "zen of Python" -
most important of which can be reasonably agreed is the 7th: "Readability counts".
If you don't want readability at all in exchange for typing a few keywords
(which more and more automatic tools can auto-complete), I'd suggest going
for the "forth" language.
Abdulla
If someone comes with a "pythonic" way to lift restrictions on
lambda, that could be something for debate, but so far this is
just about uglifying it, and creating a new syntax matching
exactly what exists today.