[issue23591] Add Flags and IntFlags

Serhiy Storchaka report at bugs.python.org
Mon Aug 15 04:50:57 EDT 2016


Serhiy Storchaka added the comment:

You still can use identity testing for named instances of IntFlags. But since the purpose of IntFlags is replacing int flags, tested values can be int (e.g. when read from files as ints). For unknown values you should use either equality testing or wrap them in IntFlags.

In your example MyFlags.FIRST & MyFlags.SECOND is MyFlags.NONE. If MyFlags.NONE not exists, the result is MyFlags(0). You can apply the patch and experiment with it.

----------
Added file: http://bugs.python.org/file44114/intflags_3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23591>
_______________________________________


More information about the Python-bugs-list mailing list