[Python-ideas] Enums

Ethan Furman ethan at stoneleaf.us
Thu Jul 28 19:57:01 CEST 2011


Barry Warsaw wrote:
> In my experimental branch I've also made EnumValues subclasses of ints. This
> breaks one test in my Mailman 3 test suite, since I was using a custom encoder
> for json.dumps() which knew how to encode EnumValues. However, the json
> module doesn't allow you to override the encoding of basic types,

Isn't this a problem with json? An EnumValue is a subclass, after all, 
not a plain ol' straight-up int -- I would think that json should 
realize a subclass may be different and go the .default() route.
~Ethan~


More information about the Python-ideas mailing list

AltStyle によって変換されたページ (->オリジナル) /