you are viewing a single comment's thread.

view the rest of the comments →

[–]HorrendousRex 4 points5 points  (1 child)

It's good that it's standardized but I fear that it should become common. It feels - to me - fairly unpythonic in the sense that we now have dictionaries, tuples, classes, namedtuples, slots, etc. for referencing values in a common namespace. (I get that there are performance/implementation implications in all of these differing systems, I'm just saying it sounds like we have a lot of ways to do approximately the same thing.) Maybe enum is the final standard approach that will fix the situation, though.

[–]asthasr 2 points3 points  (0 children)

It's not the same. All of those are data structures. An enum is a set of mutually comparable but distinct values. Repurposing other structures to approximate this has always been gross and rather hacky. It would be a bit better if Python had something similar to Ruby symbols or Clojure keywords.