Enums and Python

Cameron Laird claird at starbase.neosoft.com
Tue Jun 20 23:22:46 EDT 2000


In article <8ip8rf$1ig$1 at slb7.atl.mindspring.net>,
Aahz Maruch <aahz at netcom.com> wrote:
>In article <QoU35.15352$Xx5.796205 at bgtnsc06-news.ops.worldnet.att.net>,
>William Dandreta <wjdandreta at worldnet.att.net> wrote:
>>
>>Is there a Python type like the C enum type?
>
>I generally prefer using a dict to simulate it.
			.
			.
			.
I'll say that more forcefully than Aahz does here:  while
enums are often a marker of good taste in C coding, Python
generally achieves the same results with a considerably
cleaner reformulation in terms of dicts.  If you feel a
need for enums while writing Python, you're probably missing
out on a better (and not-so-reminiscent-of-C) coding.

I've become rather dogmatic on this point.  I need the
practice of working to falsify it.  If you have a specific
algorithm you can share that you see as ripe for a Python
enum, please tell us here; maybe we can suggest an
alternative.
-- 

Cameron Laird <claird at NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list