My first thought exactly. Lisp is based on lambda calculus and it doesn't do automatic currying. Multiline lambdas require block delimiters more sophisticated than whitespace; hence they don't work in Python. It's no more complicated than that.
Languages which do that have issues representing very useful software engineering tools: optional arguments, variadic arguments and keyword arguments.
Currying is related to partial application; it refers to a technique for representing multivariate functions using only functions of one argument.
E.g. to obtain some f(x, y, z) we instead make it f(x)(y)(z), where f is a one-argument function applied to (x). That yields an anonymous one-argument function that is applied to (y), and that again yields a one-argument function applied to (z), which finally calculates f(x, y, z).
Whereas partial application is this: we already have a bona fide three-argument f(x, y, z), and the ability to call it with all three arguments at once. But for some reason, we call it as f(x)(y)(z). Now f needs 3 arguments but is called with just one, (x). So an anonymous two-argument function is produced which, if given two arguments will combine those with the one that was given and call f. Alas, that function is given only one argument, so it returns another one-argument function. When that one is given an argument, it all unwraps, and f ends up being called. These anonymous functions are understood to be produced because our notation is understood to have implicit partial application semantics. Under currying, things aren't implicit; f(x) is written as a one-argument function, which will have a lambda term in it. There is nothing to be implicit about in terms of application: all functions have one argument.
foo((lambda x, y:
for i in range(x):
y += i
return y),
20
) foo (lambda x, y::, 20) # :: means body of lambda follows
:: # optional, if there is only one lambda and line has no argument lines
for i in range (x):
y += i
return y
The lambda bodies immediately follow the line. If the line has arguments, those follow the lambdas: if foo(lambda x::, list) < bar(lambda y::, list):
:: # lambda x
return x + x
:: # lambda y
return 2 * y
return list # then statement of ifPerhaps the double colon would be unnecessary: just make the expression optional, and if it's missing then there has to be an "outboard" body.
if foo(lambda x:, list) < bar(lambda y:, list):
def: # lambda x
return x + x
def: # lambda y
return 2 * y
return list # then statement of ifAlmost all programmers can read a C-like language because well, that covers like 95% of languages by use. You have C/C++/Java/Go/JS/Kotlin/Rust/zig/C# etc.
BUT second to that in sheer use is probably Python. Almost everyone (that I know) has touched it atleast a bit whether its dev scripts, tooling, scientific work (bio, cv, etc.), robotics, mech engineers, ml/ai space etc.
Why would anyone nitpick to death tools that have so much ubiquity? Well they'd have to have a narrow focus to even consider it. The majority of algebra users never second guess +, *, ^, (), etc.
I'd say lisp is probably the hardest to get used to combine with the least frequent to cross your path. And then there's a long tail of bash/ruby styles, tcl, ocaml, etc etc.
With a few weeks of study to "re"learn C and/or C++? Sure, they're just programming languages. But right off the bat? No idea what the hell is going on in real, production C code.
Casting pointers isn't difficult to read because dereference and multiplication share *, it's difficult to understand because it's not something you do outside of C.
Similarly, if you can grasp the concept of a paragraph, or of bullet points, or a bunch of other things in normal text that convey meaning through whitespace, then you can deal with another.
It's only code that (some) people complain about this with. In every other context, we all know that we can work with syntax based either on brackets or spacing. Just in normal communication, all humans deal with a dizzying array of complex conventions without even thinking about it.
The reluctance to use whitespace-sensitive languages (or the other way around) is learned helplessness, rather than a widespread inadequacy.
Dependency management would be an example of a real Python issue, not a "everyone gets used to it" one IMO.
def check(situation):
if situation.under_nuclear_attack:
situation.set_alert_level(RED)
-------------- bottom of window -----------------
Is that the whole function? Does it forget to launch the counterstrike? Or is there more? We don't know without scrolling down.You can change the meaning of code, without changing its whitespace sensitive diff (git diff { -w | -b }).
This one is backwards: the benefit is forcing beginners to write well-formatted code. You would not believe the insane things people just learning can come up with, when in a C-style language where indentation doesn't matter.
For go, gofmt is so opinionated that you can't even configure it, which is kinda cool because it means all go code that uses it will look the same.
There's also rustfmt for rust and prettier for JS/TS (and I assume similar for lots of other languages I'm not familiar with), both of which are configurable, which I prefer - but I can see the upsides of a one-size-fits-all code formatting tool (especially for a language like go where a reasonably constrained feature set/syntax is an explicit goal of the language).
It can take command line options, or it can be configured in your Poetry pyproject.toml file.
https://black.readthedocs.io/en/stable/usage_and_configurati...
Anyway I think Guido hates lambda because it feels like an appendage in Python, due to list comprehensions and due to expression-only bodies, restriction which was put in place probably because passing multi-line nameless functions as arguments is awkward in a whitespace-sensitive language/it just didn’t feel Pythonic to Guido to be passing large inline functions to functions.