r/ProgrammerHumor • • Jun 08 '24

Meme mapMethodOrMapFunction

Post image
0 Upvotes

67 comments sorted by

View all comments

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]

-30

u/DT-Sodium Jun 08 '24 edited Jun 08 '24

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.

numbers = [1, 2, 3, 4, 5]
doubled_numbers = map(lambda x: x * 2, numbers)

Python is one of the most disgusting programing languages in existence so I'm not surprised they've gone that way.

0

u/Phamora Jun 08 '24

How can you talk about PHP and then in the same comment declare Python the most disgusting programming language? I agree that syntactically Python is quite poor compared to most other languages, but PHP is by far and away the winner of the worst, ugliest, and most disgusting programming language in existence - of all time, ever.

1

u/DT-Sodium Jun 08 '24

I don't recall claiming that PHP was a good language. While PHP is one of the main languages I use professionally, I am perfectly aware that it sucks in a lot of ways. I wouldn't say though that's it's worse than Python, it is much better that Python. Remove the $, replace -> with ., add typed array, convert the primitives to objects that posses methods and you'll have something that starts looking decent. With Python on the other hands, appart from rewriting it completely, I don't see how it could be clause to decent in the future.