[Python-Dev] Enum, Flag, contains, and False vs TypeError (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Wed Apr 4 16:11:42 EDT 2018
- Previous message (by thread): [Python-Dev] Enum, Flag, __contains__, and False vs TypeError
- Next message (by thread): [Python-Dev] Enum, Flag, __contains__, and False vs TypeError
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I expect that for IntFlag x in flags
is equivalent either to
bool(x | flags.value)
or to
(x | flags.value) == x
It should return some result only if x is an integer (or compatible with integers) and raise a TypeError otherwise.
Don't add any special checks unless there are good reasons for this. Keep the code as simple as possible.
- Previous message (by thread): [Python-Dev] Enum, Flag, __contains__, and False vs TypeError
- Next message (by thread): [Python-Dev] Enum, Flag, __contains__, and False vs TypeError
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]