4 ms·
Presumably, you should also be able to do something like this: class Colour(Enum): red, green, blue = range(3)
by dlitz 13y ago
Presumably, you should also be able to do something like this:
class Colour(Enum):
red, green, blue = range(3)
- sn6uv 13y agorange(1,4)* because it counts from 1 (range counts from 0).
- Tobu 13y agoStarting from zero solves the "one right way to do it" problem which is mentioned in the blog post.
- marcosdumay 13y agoYes, but recreates the "a value must be true in a boolean context" problem discussed in the PIP.