On Thu, May 27, 2021 at 8:30 PM Ethan Furman <et...@stoneleaf.us> wrote:

> But what if we have something like:
>
>      class Color(Flag):
>          RED = 1            # 0001
>          BLUE = 4           # 0100
>          WHITE = 7          # 0111
>
> As you see, WHITE is an "alias" for a value that does not exist in the
> Flag (0010, or 2).  That seems like it's probably an error.


Are there use cases where you want to support gaps in the bits? If not,
your decorator could accept which flags should be spanned. That seems
useful, too. It would be a strictly stronger check. That would change the
kind of name you want, though.

Otherwise, some things that occur to me: factorable, factorizable,
factorized, decomposable. The thinking here is that each named member
should be capable of being decomposed / factored into individual values
that themselves have names.

--Chris



>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/S6232IQIUAZKRXNPDPCS755LCVAFBE37/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to