[Python-Dev] Best practices for Enum

Gregory P. Smith greg at krypto.org
Tue May 14 08:51:35 CEST 2013


On Sun, May 12, 2013 at 4:49 PM, Raymond Hettinger <
raymond.hettinger at gmail.com> wrote:

>
> * will enums break doctests or any existing user code
>

Those are already broken by design.  We shouldn't be limited just because
someone wrote a bad test that assumed a particular repr of a value.  We've
already broken that assumption several times in the past from the recent
hash randomization change to removing the evil trailing Ls on the old long
type, changing the float str vs repr, particular information and wording of
exception error messages, etc.

This sounds like a feature request for doctest.  doctest could be educated
about enums and automatically compare to the integer value for such cases.

Regardless, it sounds like the consensus agrees with your overall
sentiment: refrain from mass converting things "just because" and start
with an obvious improvement like the socket module.

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130513/ea461380/attachment.html>


More information about the Python-Dev mailing list