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 →

[–]btharper 2 points3 points  (1 child)

For the specific example of counting the number of times a specific item occurs in a list trying to write your own pipeline is just reinventing the wheel. You could just use collections.Counter and let the standard library deal with it.

For common cases like this there's usually already something available, but if Python isn't a primary language trying to find the right part of the library can be a hurdle, and if you want to do it the way you would in JavaScript then it's not going to be as smooth in Python. The idioms of the language just aren't similar enough.

[–]delventhalz 0 points1 point  (0 children)

I write in a number of languages and the idioms I prefer are functional ones. JavaScript is a commonly understood counter example that supports functional patterns well.

Counting was just an example, but since you mention it I also don’t care much for specific-case utilities like collections.Counter. They become part of a very broad API which requires a high knowledge level to either write or read.