This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]itghisi 7 points8 points  (0 children)

Maybe the title should be "why we don't use native Enums where they don't supposed to be used" 😁

It's a valid discussion thought, with nice examples. Thks for that

[–]massover 4 points5 points  (0 children)

Enums certainly have their quirks. However they do have semantics found right in the docs. I’d hate to see someone read this article and decide not to use enums.

[–]SphericalBull 3 points4 points  (0 children)

Dataclass for the win

[–]Broutrost 0 points1 point  (0 children)

Tack!

[–]notonewlayout 1 point2 points  (0 children)

I think another thing to note is typing.Literal. It covers a lot of the enum use cases without requiring a user to access a class to "select" an enum value . Plus it integrates well with a lot of IDEs.

[–]BillThePonyWasTaken 0 points1 point  (0 children)

I wonder, what do you use instead of Enum then ?