Python enum implementation -


this question has answer here:

i have declared enum follows in python.i don't know how use them.when create instance of class gives error 2 arguments required 1 given.

class cbarreference(enum):     thisbar = 0, nextbar = 1, undefined=2 a=cbarreference() 

i know error don't know give second argument other self.

you should never have create instance of enum; they're accessed directly class, , can assign them variables like:

a = cbarreference.thisbar b = cbarreference.nextbar c = cbarreference.undefined d = cbarreference.thisbar assert(a == d) assert(b != a) assert(b != c) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -