Like c enumeration in python3

Paulo da Silva p_s_d_a_s_i_l_v_a_ns at netcabo.pt
Sun Mar 22 22:18:30 EDT 2020


Hi!

Suppose a class C.
I want something like this:

class C:
	KA=0
	KB=1
	KC=1
	...
	Kn=n

	def __init__ ...
		...


These constants come from an enum in a .h (header of C file).
They are many and may change from time to time.
Is there a way to somehow define them from inside __init__ giving for
example a list of names as strings?
There is an additional problem: C is not recognized inside __init__!

Thanks.


More information about the Python-list mailing list