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

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlibSteven D'Aprano steve at pearwood.info
Tue Nov 23 22:06:45 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.

That doesn't make auto-enumeration "useless". Unnecessary, perhaps, but 
not useless.

But even then it's only unnecessary if the number of constants are small 
enough that you can see how many there are without counting 
(essentially, 4 or fewer). When you have more, it becomes error-prone 
and a nuisance to have to count them by hand:

Constants = make_constants(
     'Constants',
     'ST_MODE ST_INO ST_DEV ST_NLINK ST_UID ST_GID' \
     'ST_SIZE ST_ATIME ST_MTIME ST_CTIME',
     values=range(10)
     )


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