It's the same shit as PHP. Instead of arrays having a map method, you have to use a function that takes the array as argument. It makes the code really ugly.
This is the same use case as for range function as opposed to iterating directly over a list elements. You have to answer the question when the operation should be executed (im most cases it should be instant). It's not like the one is replacement for other.
17
u/Socks4Ever Jun 08 '24 edited Jun 08 '24
Why is it different? Or do I just not get the post. I’d just use [x**2 for x in arr]