[Python-checkins] cpython (merge 3.2 -> default): #11964: Document a change in v3.2 to the json indent parameter

petri.lehtinen python-checkins at python.org
Tue Aug 28 11:36:45 CEST 2012


http://hg.python.org/cpython/rev/0fb511659ef4
changeset:   78781:0fb511659ef4
parent:      78779:7fa6336e9864
parent:      78780:5bff555168ab
user:        Petri Lehtinen <petri at digip.org>
date:        Tue Aug 28 12:34:09 2012 +0300
summary:
  #11964: Document a change in v3.2 to the json indent parameter

files:
  Doc/library/json.rst |  16 ++++++++++++----
  Misc/NEWS            |  30 ++++++++++++++++++++++++++++++
  2 files changed, 42 insertions(+), 4 deletions(-)


diff --git a/Doc/library/json.rst b/Doc/library/json.rst
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -149,6 +149,9 @@
    indents that many spaces per level.  If *indent* is a string (such as ``"\t"``),
    that string is used to indent each level.
 
+   .. versionchanged:: 3.2
+      Allow strings for *indent* in addition to integers.
+
    If *separators* is an ``(item_separator, dict_separator)`` tuple, then it
    will be used instead of the default ``(', ', ': ')`` separators.  ``(',',
    ':')`` is the most compact JSON representation.
@@ -371,10 +374,15 @@
    will be sorted by key; this is useful for regression tests to ensure that
    JSON serializations can be compared on a day-to-day basis.
 
-   If *indent* is a non-negative integer (it is ``None`` by default), then JSON
-   array elements and object members will be pretty-printed with that indent
-   level.  An indent level of 0 will only insert newlines.  ``None`` is the most
-   compact representation.
+   If *indent* is a non-negative integer or string, then JSON array elements and
+   object members will be pretty-printed with that indent level.  An indent level
+   of 0, negative, or ``""`` will only insert newlines.  ``None`` (the default)
+   selects the most compact representation. Using a positive integer indent
+   indents that many spaces per level.  If *indent* is a string (such as ``"\t"``),
+   that string is used to indent each level.
+
+   .. versionchanged:: 3.2
+      Allow strings for *indent* in addition to integers.
 
    If specified, *separators* should be an ``(item_separator, key_separator)``
    tuple.  The default is ``(', ', ': ')``.  To get the most compact JSON
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -2,6 +2,36 @@
 Python News
 +++++++++++
 
+What's New in Python 3.3.1
+==========================
+
+*Release date: XX-XX-XXXX*
+
+Core and Builtins
+-----------------
+
+Library
+-------
+
+Extension Modules
+-----------------
+
+Tests
+-----
+
+Build
+-----
+
+Documentation
+-------------
+
+- Issue #11964: Document a change in v3.2 to the behavior of the indent
+  parameter of json encoding operations.
+
+Tools/Demos
+-----------
+
+
 What's New in Python 3.3.0 Release Candidate 2?
 ===============================================
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list