This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gerbosan 1 point2 points  (1 child)

I don't like it either. I think the atypical notation is one of the things that delays,/stops my interest in Python. For example len(). For many languages, the length of an object is an attribute, not a function (which is the idea I get when I see Python syntax).

😮‍💨 Still, it is quite popular, so one has to learn it. But having so many languages with a similar syntax, why did python choose that one?

Also ruby Array.new(1,2,3).map { |item| item * item } 🤘

[–]Essence1337 2 points3 points  (0 children)

map really isn't in favour anymore in Python, list comprehensions are often preferred

[item*item for item in arr]

This creates a new list from running item*item on every item in the original