Serhiy Storchaka added the comment:

I choose repr() so that for single flag it looks as for IntEnum instance. Other 
variants except <Perm.R|Perm.W: 3> have different format. <Perm.R|Perm.W: 3> is 
too verbose, it repeats the same class name multiple times.

But I don't like current repr.

Other operators are not overridden for purpose. IntFlags is int and can be used 
in all cases when int is used, but not in all cases the result should preserve 
the type. FLAG1 + FLAG2 works as if flags would be ints, but it should be 
rewritten to FLAG1 | FLAG2 to got the benefit from using IntFlags.

However I forgot to override the exclusive-or operator. It should be overridden.

Updated patch changes str and repr, override the exclusive-or operator and adds 
some documentation.

----------
Added file: http://bugs.python.org/file38387/intflags_2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23591>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to