from enum import Enum
class InputTypes(Enum):
"""
Flags to represent the different kinds of input we
are acting on from the user
"""
KEYBOARD = 0b00000001,
MOUSE_BUTTONS = 0b00000010,
MOUSE_MOVE = 0b00000100,
ALL = 0b11111111
if __name__ == "__main__":
x = (InputTypes.KEYBOARD | InputTypes.MOUSE_BUTTONS)
我遇到了一个错误:
TypeError: unsupported operand type(s) for |: 'InputTypes' and 'InputTypes'
如何在Python 2.7和Python 3中正确定义一些标志并使用它们?