From ffd476c0209131c253ab34d2742ac22527e3f3e6 Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 12 Jan 2018 20:17:00 +0100 Subject: [PATCH] Make the Python 2 aspect more visible * Add Python 2 to the heading. * Mention that ``xrange()`` is Python 2 only, too. --- .../not_using_iteritems_to_iterate_large_dict.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/performance/not_using_iteritems_to_iterate_large_dict.rst b/docs/performance/not_using_iteritems_to_iterate_large_dict.rst index 97fbca3..f842f79 100644 --- a/docs/performance/not_using_iteritems_to_iterate_large_dict.rst +++ b/docs/performance/not_using_iteritems_to_iterate_large_dict.rst @@ -1,9 +1,9 @@ -Not using ``iteritems()`` to iterate over a large dictionary -============================================================ +Not using ``iteritems()`` to iterate over a large dictionary in Python 2 +======================================================================== `PEP 234 `_ defines iteration interface for objects. It also states it has significant impact on performance of dict iteration. -.. note:: This anti-pattern only applies to Python versions 2.x. In Python 3.x ``items()`` returns an iterator (consequently, ``iteritems()`` has been removed from Python 3.x). +.. note:: This anti-pattern only applies to Python versions 2.x. In Python 3.x ``items()`` returns an iterator (consequently, ``iteritems()`` and Python 2's iterative ``range()`` function, ``xrange()``, have been removed from Python 3.x). Anti-pattern