homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author veky
Recipients barry, eli.bendersky, ethan.furman, ezio.melotti, python-dev, r.david.murray, rhettinger, serhiy.storchaka, veky
Date 2016年09月13日.20:15:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473797711.42.0.109847040944.issue23591@psf.upfronthosting.co.za>
In-reply-to
Content
Now that I actually had the chance to play with the implementation, I see most of my worst fears were justified. :-( Look:
 >>> import enum
 >>> class B(enum.Flag):
 b = 3
 c = 4
 d = 6
 >>> B.b | B.c
 Traceback (most recent call last): ...
 ValueError: 7 is not a valid B
 >>> t = B.b | B.c
 >>> t
 <B.d|1: 7>
 >>> B.b | B.c
 >>> B.b | B.c
 <B.d|1: 7>
 >>> ~B.d
 <B.0: 0>
Do you really find this behavior acceptable?? I see at least three bugs here.
At least you did say in the documentation
> Individual flags should have values that are powers of two (1, 2, 4, 8, ...)
but it seems to me it's not prominent enough.
---
Also, auto, despite parentheses, works exactly as it shouldn't.
 >>> class C(enum.Enum):
	a = b = enum.auto()	
 >>> C.a
 <C.a: 1>
 >>> C.b
 <C.b: 2>
 >>> def f():
 return enum.auto()
 >>> class E(enum.Enum):
 a = b = f()
 c = d = 2
 >>> E.a is E.b
 False
 >>> E.c is E.d
 True
 >>> E.b is E.c
 True
In my opinion, this is simply horrible. Even _you_ said (http://bugs.python.org/issue23591#msg275093) this would be unacceptable. I'm really, really sad.
History
Date User Action Args
2016年09月13日 20:15:12vekysetrecipients: + veky, barry, rhettinger, ezio.melotti, r.david.murray, eli.bendersky, ethan.furman, python-dev, serhiy.storchaka
2016年09月13日 20:15:11vekysetmessageid: <1473797711.42.0.109847040944.issue23591@psf.upfronthosting.co.za>
2016年09月13日 20:15:11vekylinkissue23591 messages
2016年09月13日 20:15:11vekycreate

AltStyle によって変換されたページ (->オリジナル) /