News for hackers. Stuff that matters.
Re:Using Enumerated Types in Python by tobywf on Saturday June 06, 2020 @02:59PM (#23441480)
AFAIK, they're talking about languages like Rust, or C/C++ with `-Wswitch` (also implied by `-Werror`, which will warn you if you haven't handled all enum cases in a match/switch statement.

as someone else in this thread pointed out [0], it's possible with MyPy when using if/elif/else, or if you did it with a dictionary lookup, you could write a very simple test that checks that the set of enum values is equal to the dictionary key members. I've done this before, it works well [1].

[0] https://news.ycombinator.com/item?id=23441023 [1] https://github.com/aws-cloudformation/cloudformation-cli/blo...

There are no comments on this comment yet.