Skip to content Skip to sidebar Skip to footer
Showing posts with the label Enums

Is There A Python Class/enum For Flag/bit Mask Operations?

I know of base classes Enum and IntEnum. Both are very helpful but I miss features for flag operati… Read more Is There A Python Class/enum For Flag/bit Mask Operations?

How To Print Combined Flag In The Same Way As Name Property

In Python, you can use the Flag class to represent combinations of values. class Color(Flag): R… Read more How To Print Combined Flag In The Same Way As Name Property

Interpret An Integer As Enum Flags

Suppose I have a Flag enum like this: From enum import Flag class suspicion(Flag): TOT_PCNT_LO… Read more Interpret An Integer As Enum Flags

Iterate Enum In Definition Order In Python 2

I'm using the backported Enum functionality from python 3.4 with python 2.7: > python --vers… Read more Iterate Enum In Definition Order In Python 2

How Do I Correctly Call A Function That Takes A "custom Enum" As Argument Using Ctypes And Ctypes Based Enums?

I really hope some Python/Ctypes/C expert can help me with this one, it is probably my lack of know… Read more How Do I Correctly Call A Function That Takes A "custom Enum" As Argument Using Ctypes And Ctypes Based Enums?

How Do I Properly Document Python Enum Elements?

I understand that I can add a Python docstring to an enum type as I would any other class. But how … Read more How Do I Properly Document Python Enum Elements?

Pyqt5 && Qml Exporting Enum

Is it possible to export enum from Python to QML instance? class UpdateState(): Nothing = 0 … Read more Pyqt5 && Qml Exporting Enum

Returning A List Of Enums With String Values With Graphene

This is using Python and the Graphene library. I want to provide a list of constants to my front-en… Read more Returning A List Of Enums With String Values With Graphene

How To Iterate Within A Specific Range Of Enum Class With Hex Value In Python

I have the following class enum: class LogLevel(Enum): level_1 = 0x30 level_2 = 0x31 le… Read more How To Iterate Within A Specific Range Of Enum Class With Hex Value In Python

Enum Class Method With Default Enum Value Fails

I am well aware that if you have a class method that uses the enum's class name for type hintin… Read more Enum Class Method With Default Enum Value Fails

Ubuntu 16.04, Python 2.7 - ImportError: No Module Named Enum

First time using Ubuntu. I installed Anaconda 4.1.1 (Python 2.7). I was trying to use enum but I go… Read more Ubuntu 16.04, Python 2.7 - ImportError: No Module Named Enum