Ethan Furman added the comment:

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. ;)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to