Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/writing/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ keep a count of your place in the list.
# 1, 4
# 2, 5

The ``enumerate`` function has better readability than handling a counter manually. Moreover,
it is better optimized for iterators.

Read From a File
----------------

Expand All @@ -284,6 +287,9 @@ files for you.
for line in f:
print line

The ``with`` statement is better because it will ensure you always close the file,
even if an exception is raised.

Returning Multiple Values from a Function
-----------------------------------------

Expand Down