c enum - how to do this in python?
sismex01 at hebmex.com
sismex01 at hebmex.com
Fri Feb 21 16:37:14 EST 2003
> From: Klaus Meyer [mailto:km-news1 at onlinehome.de]
> Sent: Friday, February 21, 2003 3:26 PM
>
> Hi,
>
> C has enum to define named constant like:
> enum { M0, M1, M2, MCOUNT };
> (MCOUNT gives the number of constants, nice for loops or so)
>
> How to do this in Python?
>
Do what?
Have a certain number of enumerated constants?
M0 = 0
M1 = 1
M2 = 2
...
MCOUNT = n
Create a list of symbols you can iterate through?
for i in [ M0, M1, M2, ... ]:
...
More information on what you want to do with this
can help us wean you from the C style of doing
things in the small, and get on with solving
the big problems. :-)
-gustavo
More information about the Python-list
mailing list