[Python-ideas] Enum and serialization

Giampaolo Rodola' g.rodola at gmail.com
Fri Jul 19 01:54:07 CEST 2013


On Thu, Jul 18, 2013 at 8:24 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> See http://bugs.python.org/issue18264.

Oh, OK. Glad to see this is being tracked.

> The basic issue is that json only knows how to serialize built-in types.  As
> soon as we build on that, json barfs.
>
> One way around that is to write your own json handler that knows about your
> custom types.
>
> For the 3.4 stdlib there are two proposals on the table:
>
>   1) for IntEnum and FloatEnum cast the member to int or float, then
> procede;
>
>   2) for any Enum, extract the value and proceed.

What about third party serialization libs though?

--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/


More information about the Python-ideas mailing list