Message148679
I've been looking at code on the tutor mailing list for some time, and
for line in file.readlines(): ...
is a common idiom there. I suppose this is because the readlines() method is easily discoverable while the proper way (iterate over the file object directly) is not.
A note added to the readlines() documentation might help:
"""
You don't need the readlines() method to loop over the lines of a file.
for line in file: process(line)
consumes less memory and is often faster.
""" |
|
Date |
User |
Action |
Args |
2011-11-30 17:42:30 | peter.otten | set | recipients:
+ peter.otten, docs@python |
2011-11-30 17:42:29 | peter.otten | set | messageid: <1322674949.97.0.856520026774.issue13510@psf.upfronthosting.co.za> |
2011-11-30 17:42:01 | peter.otten | link | issue13510 messages |
2011-11-30 17:42:01 | peter.otten | create | |
|