[Python-ideas] IntFlags

Serhiy Storchaka storchaka at gmail.com
Wed Mar 4 16:58:37 CET 2015


On 04.03.15 17:31, Chris Angelico wrote:
> On Thu, Mar 5, 2015 at 2:17 AM, Andrew Barnert
> <abarnert at yahoo.com.dmarc.invalid> wrote:
>> Another issue that came up was that C flags often have "combined" names that are ambiguous: RDWR = RDONLY | WRONLY), which is fine until you want a repr (in C, it's just going to print 3); does it have to be smart enough to show RDWR? (Or, worse, RDWR | CLOEXEC.)
> That could probably be handled by going through the flags in iteration
> order. If the flag is present, emit it and move on. Something like
> this:

Yes, something like this, but with iterating flags in descended sorted 
order, and with special case for negative value.




More information about the Python-ideas mailing list