A simple array in Python

Laszlo Nagy gandalf at designaproduct.biz
Tue Jan 9 11:19:15 CET 2007


bg_ie at yahoo.com wrote:
> Hi,
>
> I have the following enum -
>
> class State:
> 	Fire = 0
> 	Water = 1
> 	Earth = 2
>
> And I want a variable which holds a value for each of these states,
> something like -
>   

class State:
	Fire = 0
	Water = 1
	Earth = 2


myState = {} # It is a dictionary, see 
http://docs.python.org/tut/node7.html#SECTION007500000000000000000
myState[State.Fire] = 20
myState[State.Earth] = 24
print myState

{0: 20, 2: 24}





More information about the Python-list mailing list