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

[Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

[Python-Dev] Purpose of Doctests [Was: Best practices for Enum]Nick Coghlan ncoghlan at gmail.com
Sun May 19 13:49:19 CEST 2013
On Sun, May 19, 2013 at 4:41 PM, Raymond Hettinger
<raymond.hettinger at gmail.com> wrote:
> nicer repr" is worth "Sorry, I broke your tests, made your published
> examples
> out of date, and slowed down your code."

While the first two considerations are always potentially applicable
when using enums, the latter should only be true for code that uses
str() and repr() a lot. For other operations, int-based enums
shouldn't add any more overhead than namedtuple does for tuples.

I agree with basically everything you said, but I don't want "enums
are slower than normal integers" to become a meme - there really
shouldn't be a speed difference for any arithmetic operations when
using IntEnum.

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
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