Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • "a dict-value object which is a set-like object and uses a hash table for storing its items" - That's incorrect; see docs: "Values views are not treated as set-like since the entries are generally not unique." Commented Aug 25, 2024 at 19:30
  • @wjandrea Yeah, I guess keys would be more accurate, thanks for pointing that out. Commented Sep 20, 2024 at 2:37
  • Keys? No, what I was saying was that a dict_values object isn't set-like and doesn't use a hash table. It doesn't even have keys, so I'm not sure where you got that from. Commented Sep 20, 2024 at 17:22
  • @wjandrea Yes, Of course. I'm not sure either. Perhaps in previous versions that was the case? Eitherway, I updated the answer. Thanks for the comment. Commented Sep 24, 2024 at 22:17
  • Awesome, much improved! However, I'm not sure what you mean by "optimized for operations like membership checking". Since they're not set-like, I don't think they can do any better than O(n), just like a list. You might still be thinking of sets, which are O(1) on average due to the hash table. Commented Sep 24, 2024 at 23:19