New submission from Matthew Havard:

The documentation from json.dumps says this about skipkeys:

    If ``skipkeys`` is false then ``dict`` keys that are not basic types
    (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped
    instead of raising a ``TypeError``.

However, that contradicts the docstrings for JSONEncoder in the encoder.py 
file, and json.dump in the same file, __init__.py:

json.dump:
    If ``skipkeys`` is true then ``dict`` keys that are not basic types
    (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped
    instead of raising a ``TypeError``.

JSONEncoder:
        If skipkeys is false, then it is a TypeError to attempt
        encoding of keys that are not str, int, long, float or None.  If
        skipkeys is True, such items are simply skipped.

So the fix is just that the word "false" to "true".

----------
messages: 245997
nosy: Matthew Havard
priority: normal
severity: normal
status: open
title: Documentation about skipkeys parameter for json.dumps is incorrect
versions: Python 2.7

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

Reply via email to