A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-February/132473.html below:

[Python-Dev] Pickling of Enums

[Python-Dev] Pickling of Enums [Python-Dev] Pickling of EnumsSerhiy Storchaka storchaka at gmail.com
Tue Feb 18 20:46:27 CET 2014
18.02.14 20:16, Ethan Furman написав(ла):
> This conversation wasn't in the PEP, but as I recall we decided to go
> with value instead of name for json because the receiving end may not be
> running Python.
>
> Is having json do it one way and pickle another a problem?

We decided to go with value instead of name for JSON because JSON 
doesn't support enums, but supports integers and strings, and because 
enums are comparable with they values, but not with they names.

 >>> json.loads(json.dumps(socket.AF_INET)) == socket.AF_INET
True

We simply had no other choice.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4