[issue24540] Documentation about skipkeys parameter for json.dumps is incorrect

2015-06-30 Thread Matthew Havard

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 
<http://bugs.python.org/issue24540>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24540] Documentation about skipkeys parameter for json.dumps is incorrect

2015-07-05 Thread Matthew Havard

Matthew Havard added the comment:

It's in the actual code in the docstring: 
https://hg.python.org/cpython/file/6905a7f8c7ac/Lib/json/__init__.py#l187

I'm really new to Mercurial, so I'm not quite sure how to link to the 2.7 
version of the Mercurial repo, but here is the link to Lib/json/__init__.py in 
the 2.7 version on Github:
https://github.com/python/cpython/blob/2.7/Lib/json/__init__.py#L198

--

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



[issue24540] Documentation about skipkeys parameter for json.dumps is incorrect

2015-07-05 Thread Matthew Havard

Matthew Havard added the comment:

Also, this typo is present in all versions anyway.

--

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



[issue24540] Docstring for json.dumps skipkeys parameter is incorrect

2015-07-05 Thread Matthew Havard

Matthew Havard added the comment:

Great!  Glad to be of service.

--

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