2 ms·
This use of "idiom" is well established outside of natural language. Merriam-Webster gives the following as the third sense of "idiom": > a style or form of ar
by DonaldPShimoda 7y ago
This use of "idiom" is well established outside of natural language. Merriam-Webster gives the following as the third sense of "idiom":
> a style or form of artistic expression that is characteristic of an individual, a period or movement, or a medium or instrument
So it doesn't have to be inscrutable; just something that's characteristic of a particular way of doing things. The Python community favors list comprehensions over maps and filters, so using list comprehensions is part of writing idiomatic Python even though they are not in themselves impossible to understand.
- c3534l 7y agoI would agree that using list comprehensions over iterating is idiomatic Python, but I would not say that the task of applying a function to a list is an idiom like how the website seems to indicate. There may or may not be an idiomatic way in a given language, it's really dependant on the language which is why you can't map tasks to idioms. C# has Python list comprehensions, but it's not the preferred way to do things and so I wouldn't call it a programming idiom. I'm not trying to argue that programming idioms are the exact same thing as idiomatic expressions, I was trying to explain what programming idioms are by appealing to the sense in which the term was coined.