Author ethan.furman
Recipients barry, eli.bendersky, ethan.furman, ezio.melotti, python-dev, r.david.murray, rhettinger, serhiy.storchaka, veky
Date 2016-09-13.21:32:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473802346.31.0.213785709539.issue23591@psf.upfronthosting.co.za>
In-reply-to
Content
Vedran:

1) Thank you for the bug report, it's appreciated.

2) I would appreciate it even more if you just kept it to a bug report
   without the, for lack of a better word, drama.

-----------------------------------------------

>    >>> 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

This part is correct.  If the programmer wants to use actual values instead of auto() then it is on them to do it correctly.  I'd be happy to add a decorator to help ensure all bits have names, but I'm not sure what to call it.

-----------------------------------------------

>    >>> t = B.b | B.c
>    >>> t
>    <B.d|1: 7>

>    >>> ~B.d
>    <B.0: 0>

These parts are not, and will be fixed.

-----------------------------------------------

>    >>> class C(enum.Enum):
>	a = b = enum.auto()	
>    >>> C.a
>    <C.a: 1>
>    >>> C.b
>    <C.b: 2>

Bug, will be fixed.

>    >>> def f():
>            return enum.auto()
>    >>> class E(enum.Enum):
>            a = b = f()
>            c = d = 2
>    >>> E.a is E.b
>    False

Same as above bug, will be fixed

>    >>> E.c is E.d
>    True
>    >>> E.b is E.c
>    True

Same as above bug, will be fixed.  (Had "a" and "b" been given different "auto()"s that last True would be correct as "b" would then have had a value of 2 from auto(), and "c" and "d" also were given values of 2, so all three would have been the same.)
History
Date User Action Args
2016-09-13 21:32:26ethan.furmansetrecipients: + ethan.furman, barry, rhettinger, ezio.melotti, r.david.murray, eli.bendersky, python-dev, serhiy.storchaka, veky
2016-09-13 21:32:26ethan.furmansetmessageid: <1473802346.31.0.213785709539.issue23591@psf.upfronthosting.co.za>
2016-09-13 21:32:26ethan.furmanlinkissue23591 messages
2016-09-13 21:32:26ethan.furmancreate