Message273109
Absolutely. How the hell is `green = None` explicit?!
On the other hand, `class Color(Enum, style='declarative'):` is explicit. People must learn something. Why then don't they learn the right thing instead of "hey, assigning None inside enums magically does the right thing" - except when it doesn't.
Just a hint of a nightmare scenario: you write a method decorator, but you forget to return a value from it (happened to me more times than I care to admit). Ooops, your method is now next member of your enum. Good luck debugging that. :-O
In fact, what _is_ explicit, is this:
class Color(metaclass=Enum):
green = object()
yellow = object()
I could live with it. :-) |
|
Date |
User |
Action |
Args |
2016-08-19 12:19:30 | veky | set | recipients:
+ veky, barry, rhettinger, vstinner, eli.bendersky, ethan.furman, python-dev, abarry, John Hagen, David Hagen, kennethreitz |
2016-08-19 12:19:30 | veky | set | messageid: <1471609170.1.0.143312838588.issue26988@psf.upfronthosting.co.za> |
2016-08-19 12:19:30 | veky | link | issue26988 messages |
2016-08-19 12:19:29 | veky | create | |
|