We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b432c73 + c666597 commit 5a5be7bCopy full SHA for 5a5be7b
docs/writing/style.rst
@@ -516,6 +516,7 @@ more concise syntax.
516
517
.. code-block:: python
518
519
+ a = [3, 4, 5]
520
b = [i for i in a if i > 4]
521
b = filter(lambda x: x > 4, a)
522
@@ -525,10 +526,8 @@ more concise syntax.
525
526
527
# Add three to all list members.
528
a = [3, 4, 5]
- count = 0
529
- for i in a:
530
- a[count] = i + 3
531
- count = count + 1
+ for i in range(len(a)):
+ a[i] += 3
532
533
**Good**:
534
0 commit comments