[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

Guido van Rossum guido at python.org
Sun Apr 14 06:08:34 CEST 2013


So clearly the ree expectation is that they compare equal (if the values
are).
On Apr 13, 2013 11:24 AM, "Scott Dial" <scott+python-dev at scottdial.com>
wrote:

> On 4/12/2013 10:51 PM, Steven D'Aprano wrote:
> > And two examples from asm-generic/errno.h:
> >
> > #define EWOULDBLOCK     EAGAIN  /* Operation would block */
> > #define EDEADLOCK       EDEADLK
> >
>
> That's actually even better of an example than you may have realized
> because historically EWOULDBLOCK != EAGAIN[1]. So, there very well may
> need to exist such code as:
>
> if <some hairy platform>:
>     _EAGAIN = <X>
>     _EWOULDBLOCK = <Y>
> else:
>     _EAGAIN = _EWOULDBLOCK = <X>
>
> class Errno(Enum):
>     EAGAIN = _EAGAIN
>     EWOULDBLOCK = _EWOULDBLOCK
>
> I don't think it's all that uncommon that enum values that represent
> states of a system get merged or renamed over time, and this one is a
> great example of that.
>
> [1]
>
> http://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Error-Codes.html#index-EAGAIN-97
>
> --
> Scott Dial
> scott at scottdial.com
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130413/e5f02277/attachment.html>


More information about the Python-Dev mailing list