2 odpowiedzi
+ 2
While they seem the same superficially I wouldn't call them the same. An enum in Java/C++/C# is basically a classlike construct that has a fixed set of possible values. Usually these values are integers but Java and C# allow more complex values as well. They are commonly used for representing state or grouping common constants together.
Python dictionaries are more like maps in Java. They store key/value pairs and can be changed whenever you like.
0
I think ist more seamless to tuples than dictionaries. Tuples are inmutable like Enums also are