[Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

Guido van Rossum guido at python.org
Mon Apr 29 22:00:41 CEST 2013

On Mon, Apr 29, 2013 at 12:52 PM, Oscar Benjamin
<oscar.j.benjamin at gmail.com> wrote:
> Would it not be better to avoid using isinstance() for this?

In a recent thread I explained why using isinstance() is important.
It's how we check for every other type, and it would be awlward for
type-checking frameworks to have to special-case enums. (When we're
not using duck typing.)

--Guido van Rossum (python.org/~guido)

More information about the Python-Dev mailing list