mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Update structure.rst - fix indentation bug
This commit is contained in:
@@ -811,7 +811,7 @@ The map function can be even faster than a list comprehension in some cases.
|
||||
# create a concatenated string from 0 to 19 (e.g. "012..1819")
|
||||
nums = ""
|
||||
for n in range(20):
|
||||
nums += str(n) # slow and inefficient
|
||||
nums += str(n) # slow and inefficient
|
||||
print nums
|
||||
|
||||
**Good**
|
||||
@@ -821,7 +821,7 @@ The map function can be even faster than a list comprehension in some cases.
|
||||
# create a concatenated string from 0 to 19 (e.g. "012..1819")
|
||||
nums = []
|
||||
for n in range(20):
|
||||
nums.append(str(n))
|
||||
nums.append(str(n))
|
||||
print "".join(nums) # much more efficient
|
||||
|
||||
**Better**
|
||||
|
||||
Reference in New Issue
Block a user