[issue19837] Wire protocol encoding for the JSON module

Serhiy Storchaka report at bugs.python.org
Mon Dec 2 17:19:03 CET 2013


Serhiy Storchaka added the comment:

> Changing return type based on argument *values* is still a bad idea in
> general.

However load() and loads() do this. ;)

> It also makes it hard to plug the API in to generic code that is designed
> to work with any dump/load based serialisation protocol.

For dumps() it will be simple -- `lambda x: json.dumps(x, encoding='utf-8')`. For loads() it will be even simpler -- loads() will accept both strings and bytes.

Note that dumps() with the encoding parameter will be more 2.x compatible than current implementation. This will help in writing compatible code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19837>
_______________________________________


More information about the Python-bugs-list mailing list