Author ethan.furman
Recipients amaury.forgeotdarc, barry, eli.bendersky, eric.snow, ethan.furman, ezio.melotti, gvanrossum, ncoghlan, pitrou, rhettinger
Date 2013-06-21.17:35:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371836159.69.0.175455919906.issue18264@psf.upfronthosting.co.za>
In-reply-to
Content
I'd be in favor of the __protocol__ route first and the PEP 443 route second.

The problem with just tacking in `str(int(value))` or `str(float(value))` is where does it stop?  StrEnum, TupleEnum, BytesEnum, ComplexEnum, SomeOtherInterestingConstantEnum, etc., etc..

If we go the __protocol__ route we add one method to Enum which returns the `str` of its `.value`, and we're set for every Enum.*  As a bonus, any other object that needs special json (or yaml or whatever) consideration has a fairly easy way to make it happen.

*Every normal Enum, anyway. ;)
History
Date User Action Args
2013-06-21 17:35:59ethan.furmansetrecipients: + ethan.furman, gvanrossum, barry, rhettinger, amaury.forgeotdarc, ncoghlan, pitrou, ezio.melotti, eli.bendersky, eric.snow
2013-06-21 17:35:59ethan.furmansetmessageid: <1371836159.69.0.175455919906.issue18264@psf.upfronthosting.co.za>
2013-06-21 17:35:59ethan.furmanlinkissue18264 messages
2013-06-21 17:35:59ethan.furmancreate