On Tue, 23 Nov 2010, Bill Janssen wrote:

The main purpose of that is to be able to catch type mismatches with
static typing, though.  Seems kind of pointless for Python.

The concept can work dynamically. In fact, the flufl.enum package which has been discussed here makes each enumeration into a separate class so many of the advantages of catching type mismatches are obtained.

Hey, how about this syntax:

enum Colors:
        red = 0
        green = 10
        blue

Why not

 class Color:
    red = (255, 0, 0)
    green = (0, 255, 0)
    blue = (0, 0, 255)

Seems to handle the situation OK.

Yes, this looks almost exactly like flufl.enum syntax. In any case my suggestion of a new keyword was not meant to be taken seriously. If I ever think I have a good reason to suggest a new keyword I'll sleep on it, take a vacation, and then if I still think a new keyword is justified I will specifically disclaim any possibility of the suggestion being a joke.

Isaac Morland                   CSCF Web Guru
DC 2554C, x36650                WWW Software Specialist
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to