From 963ab0aabff4f782364be233e1b9e6547596e071 Mon Sep 17 00:00:00 2001 From: Matthew Boehm Date: Sun, 28 Jul 2013 10:20:47 -0400 Subject: [PATCH] Fix enumerate code snippet to run without error message Code previously added numbers to strings, which results in a TypeError --- docs/writing/style.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/writing/style.rst b/docs/writing/style.rst index 1fbf637d6..f9146493a 100644 --- a/docs/writing/style.rst +++ b/docs/writing/style.rst @@ -548,11 +548,11 @@ keep a count of your place in the list. .. code-block:: python for i, item in enumerate(a): - print i + ", " + item + print i, item # prints - # 0, 3 - # 1, 4 - # 2, 5 + # 0 3 + # 1 4 + # 2 5 The ``enumerate`` function has better readability than handling a counter manually. Moreover,