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/2013-May/126211.html below:

[Python-Dev] Best practices for Enum

[Python-Dev] Best practices for Enum [Python-Dev] Best practices for EnumSteven D'Aprano steve at pearwood.info
Tue May 14 14:08:15 CEST 2013
On 14/05/13 16:51, Gregory P. Smith wrote:
[...]
> This sounds like a feature request for doctest.  doctest could be educated
> about enums and automatically compare to the integer value for such cases.

Please no. Enums are not special enough to break the rules.

Good: "Doctests look at the object's repr."

Bad: "Doctests look at an object's repr, unless the object is an Enum, when it will look at the enum's value."

If I want a test that checks the enum's value, then I will write a doctest that explicitly checks the enum's value.



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