[Python-ideas] IntFlags

Eugene Toder eltoder at gmail.com
Thu Mar 5 18:14:09 CET 2015


On Thu, Mar 5, 2015 at 12:03 PM, Luciano Ramalho <luciano at ramalho.org>
wrote:

> The problem is that a set is by definition unordered, but the position
> of the bits in BitFlags is crucial, so the name BitSet may not give
> the right idea.

The flags discussed so far are unordered as well. E.g. OpenMode.RDONLY |
OpenMode.WRONLY | OpenMode.CLOEXEC == OpenMode.RDONLY | OpenMode.CLOEXEC |
OpenMode.WRONLY or any other permutation. In other words, flags (aka
bitmasks) are just an optimized representation of an (unordered) set of
small integer values.

Eugene
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150305/1d5730b0/attachment.html>


More information about the Python-ideas mailing list