0
What is the reason of using enums
I really didn't find a good reason for using enums. Looking at the example codes looks like they do the things more complicated instead of making them clear. Is there any real use of it in python in which without making use of it would be harder?
1 Antwort
0
Hi. The pourpose of enumeration in every language is give a natural representation to a series of values. Imagine you create a functión that return 0 if success otherwise return a values that is the error of the code. Now imagine there are 33 posible errors that can be returned by that function. It could be difficult to remember the meaning for every error value and maintain that code with no clue of what that value means. If you give a name acording to the error for every value you may have an idea of what that means, even if you didn't saw that code before.