From 6e2bd3e7cf53a0604e1bf2338bddb73efca286b8 Mon Sep 17 00:00:00 2001 From: William Ting Date: Tue, 17 Apr 2012 00:06:21 -1000 Subject: [PATCH] Fix list manipulation comments and for loop --- 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 6ca8f22..dbe4d9b 100644 --- a/docs/writing/style.rst +++ b/docs/writing/style.rst @@ -215,12 +215,12 @@ operations on lists using a different concise syntax. .. code-block:: python - # Filter elements less than 5 + # Filter elements greater than 4 a = [3, 4, 5] b = [] for i in a: - if a > 4: - b.append(a) + if i > 4: + b.append(i) **Good**: @@ -256,7 +256,7 @@ keep a count of your place in the list. for i, item in enumerate(a): print i + ", " + item - # prints + # prints # 0, 3 # 1, 4 # 2, 5