Message273109
| Author |
veky |
| Recipients |
David Hagen, John Hagen, abarry, barry, eli.bendersky, ethan.furman, kennethreitz, python-dev, rhettinger, veky, vstinner |
| Date |
2016年08月19日.12:19:29 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1471609170.1.0.143312838588.issue26988@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. :-) |
|
History
|
|---|
| 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 |
|