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 ethan.furman
Recipients barry, eli.bendersky, ethan.furman, ezio.melotti, martin.panter, r.david.murray, serhiy.storchaka, veky
Date 2016-08-15.20:40:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471293626.09.0.619516152275.issue23591@psf.upfronthosting.co.za>
In-reply-to
Content
'.0' does not have a name unless the user defines it; similarly, '.-1' does not have a name unless the user defines it.

For Flags, negative numbers are supported in order to specify which flags are desired, but the final representation will be zero or positive:

>>> class Hah(enum.Flags):
...   this, that, these, those, thuse
... 
>>> Hah(0)
<Hah: 0>
>>> Hah(-1)
<Hah.this|that|these|those|thuse: 31>

The algorithm is simple: start with the biggest Flag and mask off matching bits until all bits are are matched.  If any unmatched bits remain an error is raised.

If a user does horrible things like your Weird class then any breakage is on them.

As it stands, Weird(7) would be <Weird.A|BC: 7>, and if A was not defined an error would be raised.
History
Date User Action Args
2016-08-15 20:40:26ethan.furmansetrecipients: + ethan.furman, barry, ezio.melotti, r.david.murray, eli.bendersky, martin.panter, serhiy.storchaka, veky
2016-08-15 20:40:26ethan.furmansetmessageid: <1471293626.09.0.619516152275.issue23591@psf.upfronthosting.co.za>
2016-08-15 20:40:26ethan.furmanlinkissue23591 messages
2016-08-15 20:40:25ethan.furmancreate