4 ms·
Lambdas are fine as is. They'd be better if there was an optional brace syntax to disambiguate scope (optional!) so you could do full functions. Never understoo
by overgard 4y ago
Lambdas are fine as is. They'd be better if there was an optional brace syntax to disambiguate scope (optional!) so you could do full functions. Never understood why that's a sticking point in the python community, you'd still have 99% whitespace based scoping, but with braces or begin/end if you need it. Feels like one of those decisions they just dug their heels in on as a matter of ideology rather than practicality.
Also though, I kind of feel like currying/partial application is one of the most overhyped feature of all time. With lexical scoping and closures, the number of times I've needed it is: never. Admittedly I'm not using lisp or haskell every day, but I feel like most of the greatest features of those languages have been generally stolen where possible, and yet currying always seems like an afterthought.
- pharmakom 4y agoIf it were available it would be part of how libraries are designed and you would use it all the time.
- overgard 4y agoI mean, it essentially is available though, "from functools import partial". I just have never seen any examples other than the perfunctory useless math ones: mult_10 = partial(mult, 10) mult_10_20 = partial(mult_10, 20) print(mult_10_20(30)) The only context I can think of off the top of my head where currying might be useful is binding a "this" or "self" object, but, if I'm using a class I already get that. Maybe you could use it to pass through some set of context objects, but then, you could already do that by just creating a data structure to hold those objects.