MrBr-github / lshca

GNU General Public License v3.0
8 stars 6 forks source link

Use Flag instead of Dict for query presets #2

Open MrBr-github opened 4 years ago

MrBr-github commented 4 years ago

This is a rather confusing usage of dict. Idiomatic approach for this case (at least in C) would be using of bitmask:

QUERY_PRESET_MST = 0x1 << 1
QUERY_PRESET_FOO = 0x1 << 2
QUERY_PRESET_BAR = 0x1 << 3
...
if query_preset & QUERY_PRESET_BAR:
    ...

Not sure if it is a pythonic way, but here is a good standard module (since 3.6, heh): https://docs.python.org/3/library/enum.html#flag

Originally posted by @amaslenn in https://github.com/MrBr-github/lshca/pull/1

MrBr-github commented 4 years ago

Handle this as soon as we'll have an installer and will be able to contain some prerequisites for python 2.7