News for hackers. Stuff that matters.
Re:Why I'm still using Python by code_runner on Friday December 30, 2022 @08:21PM (#34192294)
Multi line anonymous functions. An anonymous function is just as good as a true function in JavaScript.

Lambdas are incredibly limited and encourage the declaration of a whole separate function that now lives physically far from its use.

List comprehensions are also really underpowered and I personally hate the map and filter functions and their goofy list-like types.

Check out linq in .net, streams in Java, array in JS, collections in scala to see the expressive power of a fluent interface on collections

Re:Why I'm still using Python by beckingz on Friday December 30, 2022 @09:52PM (#34193015)
just make a function at that point??
Re:Why I'm still using Python by Spivak on Friday December 30, 2022 @10:13PM (#34193139)
> declaration of a whole separate function that now lives physically far from its use

Why are you doing that? Just declare the (named) function right there where you’re gonna use it. If it’s any endorsement CPython does it all the time.

> I personally hate the map and filter functions and their goofy list-like types.

You mean iterators? There’s nothing else they could possibly return. Map and filter are lazy and work with arbitrary iterables even ones that never end or have no possible way to define bind.

Re:Why I'm still using Python by Izkata on Saturday December 31, 2022 @12:33AM (#34193911)
> Why are you doing that? Just declare the (named) function right there where you’re gonna use it. If it’s any endorsement CPython does it all the time.

I think a lot of people have no idea nested functions exist in python...

Re:Why I'm still using Python by baq on Saturday December 31, 2022 @02:41AM (#34194476)
And nonlocal, if they want to go to js-land for a second.
Re:Why I'm still using Python by LionTamer on Friday December 30, 2022 @11:28PM (#34193559)
Completely agree. Once I discovered Java Streams it became so much more frustrating for me to write Python code that manipulated collections in anything beyond the most trivial of operations.
Re:Why I'm still using Python by idealmedtech on Saturday December 31, 2022 @09:57AM (#34196964)
Whenever I want a lamba that's multiline, I usually just declare a nested function. Usually pretty clear, and reusable, and same scope rules as a lamba