Alex Rivera | Logout

Python Multi-lined Artificial enums using range

Asked 2010-12-22T18:32:10.667
12

I am trying to make an enum-type class in Python but it gets so lengthly when you have to do

VARIABLE1, VARIABLE2, VARIABLE3, VARIABLE3, VARIABLE4, VARIABLE5, VARIABLE6, VARIABLE7, VARIABLE8, ... , VARIABLE14 = range(14)

and I've tried to set it up like the following, but ended up not working.

VARIABLE1,
VARIABLE2,
VARIABLE3,
...
VARIABLE14 = range(14)

How would I accomplish this in the simplest way possible?

Edit
Report

1 Answer

11

Oh, wow I just added brackets around the variables and it worked

(VARIABLE1,
VARIABLE2,
VARIABLE3,
...
VARIABLE14) = range(14)
answered 2010-12-22T18:34:16.517

Your Answer