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/105937.html below:

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlib [Python-Dev] constant/enum type in stdlibGreg Ewing greg.ewing at canterbury.ac.nz
Wed Nov 24 00:33:02 CET 2010
Antoine Pitrou wrote:

> Constants = make_constants('Constants', 'SOME_CONST OTHER_CONST',   
>                            values=range(1, 3))
> 
> Again, auto-enumeration is useless since it's trivial to achieve
> explicitly.

But seeing as it's going to be a common thing to do, why not
make it the default?

When defining an enum, often you don't *care* what the
underlying values are, so assigning sequential natural numbers
is as good a default as any.

In fact, with the Pascal concept of an enumerated type you
don't get any choice in the matter. It's only in the C family
that you get this bastardised conflation of enumerations with
arbitrary named constants...

-- 
Greg
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