[issue38250] enum.Flag should be more set-like

John Belmonte report at bugs.python.org
Tue Oct 13 07:27:21 EDT 2020


John Belmonte <john at neggie.net> added the comment:

I agree that a bit and one-bit flag are the same.

> only 'x' was in 'xyz', not 'xy

I don't understand the comparison, because str 'a in b' tests if 'a' is a subsequence of 'b'.  It is not a subset operation ('xz' in 'xyz' is false).

I can understand the argument that Flag has a subset operator (currently __contains__), and given that one-bit flags can be used freely with the subset operator, there is no reason to add a bit membership operator.

However, since flag values are arguably a set of enabled bits, I think the use of `in` for subset is a confusing departure from the `set` API.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38250>
_______________________________________


More information about the Python-bugs-list mailing list