Python enum implementation -
this question has answer here:
- how can represent 'enum' in python? 43 answers
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
Post a Comment