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

Adrian Sampson asampson at cs.washington.edu
Mon Apr 29 17:04:29 CEST 2013

On Apr 29, 2013, at 7:32 AM, Ethan Furman wrote:
> On 04/28/2013 01:02 PM, Guido van Rossum wrote:
>> On Sun, Apr 28, 2013 at 12:32 PM, Ethan Furman wrote:
>> - should enum items be of the type of the Enum class? (i.e. type(SPRING)
>> is Seasons)
> IMO Yes.

This decision seems natural to me, so I wrote an enumeration library
some time ago that uses a simple metaclass to achieve
"type(Season.spring) is Season":


The module has other warts but perhaps it can be helpful anyway.



More information about the Python-Dev mailing list