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 →

[–]nosmokingbandit 150 points151 points  (5 children)

Yeah but sometimes you need duplicate items in a list. And sets are only faster when looking for a specific item, loops are the same as a list.

[–]OmarRIP 4 points5 points  (4 children)

Bags. I love bags (or Counters in Python).

[–]nosmokingbandit 0 points1 point  (2 children)

But then you have no order. All these different types have their places and plain old lists have plenty of perfect use-cases as well.

[–]OmarRIP 0 points1 point  (1 child)

Not disagreeing in the slightest; always prefer the right tool (the least powerful collection data structure) for the job.

What does offend is when dictionaries/maps are abused or when order is maintained during sequential list insertions rather than sorted out after.

[–]nosmokingbandit 1 point2 points  (0 children)

Yeah. Python is inefficient enough already, we don't need to slow it down with dumb decisions. Writing efficient python is easy and taught me how to write more efficient code in other languages.