Enums and Python

Remco Gerlich scarblac-spamtrap at pino.selwerd.nl
Wed Jun 21 08:28:04 EDT 2000


Fred Gansevles wrote in comp.lang.python:
> It just occured to me: If you'd like the enums to be 'global', you can
> use the following (also-quick-but-even-dirtyer hack):
> 
> def enum(*kw):
>     globals().update(kw)
> 
> enum(Tag = 0, Date = 1, Ammount = 2)

Or even the extremely horrible hack

Tag = 0; Date = 1; Amount = 2

;-)

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
Hi! I'm a .sig virus! Join the fun and copy me into yours!



More information about the Python-list mailing list