A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-November/105933.html below:

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlibIsaac Morland ijmorlan at uwaterloo.ca
Wed Nov 24 00:15:03 CET 2010
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4