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 87a7942 + 6e9b37c commit ab866cdCopy full SHA for ab866cd
docs/writing/style.rst
@@ -261,6 +261,9 @@ keep a count of your place in the list.
261
# 1, 4
262
# 2, 5
263
264
+The ``enumerate`` function has better readability than handling a counter manually. Moreover,
265
+it is better optimized for iterators.
266
+
267
Read From a File
268
----------------
269
@@ -284,6 +287,9 @@ files for you.
284
287
for line in f:
285
288
print line
286
289
290
+The ``with`` statement is better because it will ensure you always close the file,
291
+even if an exception is raised.
292
293
Returning Multiple Values from a Function
294
-----------------------------------------
295
0 commit comments