-5

I have declared the enum as follows in python.I don't know how to use them.When I create an instance of this class it gives error as two arguments are required one given.

class CBarReference(Enum):    
ThisBar = 0,
NextBar = 1,
Undefined=2
a=CBarReference()

I know what error is but I don't know what to give as the second argument other than self.

user3755882
  • 129
  • 1
  • 2
  • 5

1 Answers1

1

You should never have to create an instance of an enum; they're all accessed directly from the class, and you can just assign them to variables as you like:

a = CBarReference.ThisBar
b = CBarReference.NextBar
c = CBarReference.Undefined
d = CBarReference.ThisBar
assert(a == d)
assert(b != a)
assert(b != c)
dustyrockpyle
  • 3,184
  • 17
  • 12