[Python-checkins] cpython: whatsnew: PEP 424 implementation.

r.david.murray python-checkins at python.org
Mon Mar 10 23:11:39 CET 2014


http://hg.python.org/cpython/rev/fada398b5d83
changeset:   89570:fada398b5d83
user:        R David Murray <rdmurray at bitdance.com>
date:        Mon Mar 10 15:00:33 2014 -0400
summary:
  whatsnew: PEP 424 implementation.

files:
  Doc/c-api/object.rst     |   6 +++---
  Doc/library/operator.rst |   4 ++--
  Doc/whatsnew/3.4.rst     |  13 +++++++++++++
  Misc/NEWS                |   3 +++
  4 files changed, 21 insertions(+), 5 deletions(-)


diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -357,9 +357,9 @@
 
 .. c:function:: Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t default)
 
-   Return an estimated length for the object *o*. First trying to return its
-   actual length, then an estimate using ``__length_hint__``, and finally
-   returning the default value. On error ``-1`` is returned. This is the
+   Return an estimated length for the object *o*. First try to return its
+   actual length, then an estimate using :meth:`~object.__length_hint__`, and
+   finally return the default value. On error return ``-1``. This is the
    equivalent to the Python expression ``operator.length_hint(o, default)``.
 
    .. versionadded:: 3.4
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -240,9 +240,9 @@
 
 .. function:: length_hint(obj, default=0)
 
-   Return an estimated length for the object *o*. First trying to return its
+   Return an estimated length for the object *o*. First try to return its
    actual length, then an estimate using :meth:`object.__length_hint__`, and
-   finally returning the default value.
+   finally return the default value.
 
    .. versionadded:: 3.4
 
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -393,6 +393,10 @@
   several cases as a result of the introduction of Argument Clinic and other
   changes to the :mod:`inspect` and :mod:`pydoc` modules.
 
+* :meth:`~object.__length_hint__` is now part of the formal language
+  specification (see :pep:`424`).  (Contributed by Armin Ronacher in
+  :issue:`16148`.)
+
 
 New Modules
 ===========
@@ -1098,6 +1102,11 @@
 reference and for use by alternate implementations of Python.  (Contributed by
 Zachary Ware in :issue:`16694`.)
 
+New function :func:`~operator.length_hint` provides an implementation of the
+specification for how the :meth:`~object.__length_hint__` special method should
+be used, as part of the :pep:`424` formal specification of this language
+feature.  (Contributed by Armin Ronacher in :issue:`16148`.)
+
 
 os
 --
@@ -1800,6 +1809,10 @@
   <http://en.wikipedia.org/wiki/Data_Execution_Prevention>`_.  (Contributed by
   Christian Heimes in :issue:`16632`.)
 
+* New function :c:func:`PyObject_LengthHint` is the C API equivalent
+  of :func:`operator.length_hint`.  (Contributed by Armin Ronacher in
+  :issue:`16148`.)
+
 
 .. _other-improvements-3.4:
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -2538,6 +2538,9 @@
 
 - Issue #16160: Subclass support now works for types.SimpleNamespace.
 
+- Issue #16148: Implement PEP 424, adding operator.length_hint and
+  PyObject_LengthHint.
+
 - Upgrade Unicode data (UCD) to version 6.2.
 
 - Issue #15379: Fix passing of non-BMP characters as integers for the charmap

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


More information about the Python-checkins mailing list