TheaterFire

Why use enums?

Posted by RojerGS@reddit | Python | View on Reddit | 7 comments

Reply to Post

7 Comments

notyoyu@reddit

This should be on r/learnpython This is just reiterating in a convoluted way what the official documentation already states. In fact, it manages to answer the question in this post's title explicitly at the very beginning: *They are most useful when you have a variable that can take one of a limited selection of values.* Source: [https://docs.python.org/3/howto/enum.html](https://docs.python.org/3/howto/enum.html) The world of tech blogs is over saturated with this kind of articles that really bring nothing new to the table and simply misdirect people from the primary sources of information.
View on Reddit #14567795

spidLL@reddit

It should be forbidden to post own blog posts
View on Reddit #14570435

spidLL@reddit

There should be a rule to forbid to post own blog posts
View on Reddit #14570382

Adrewmc@reddit

Documentation answer how not why….also post like this are not allowed in learnpython (don’t ask me why)
View on Reddit #14568130

notyoyu@reddit

You are correct.
View on Reddit #14568468

RojerGS@reddit (OP)

I can't speak for every single article written about enums, but I disagree that this article brings nothing to the table. It shows a clear, self-contained, simple, and **complete** example of the prime use case for enums. The docs are great and I refer to them very often, but they're typically not structured in this way.
View on Reddit #14568019

RojerGS@reddit (OP)

You did prompt me to link to the enum HOWTO. It'll be good for people who want to read more.
View on Reddit #14568193