<div class="gmail_quote">On Sun, Jan 22, 2012 at 8:50 AM, Rick Johnson <span dir="ltr"><<a href="mailto:rantingrickjohnson@gmail.com">rantingrickjohnson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
What does Python do when presented with this code?<br>
<br>
py> [line.strip('\n') for line in f.readlines()]<br>
<br>
If Python reads all the file lines first and THEN iterates AGAIN to do<br>
the strip; we are driving a Fred flintstone mobile. If however Python<br>
strips each line of the lines passed into readlines in one fell swoop,<br>
we made the correct choice.<br>
<br>
Which is it Pythonistas? Which is it?<br><span class="HOEnZb"></span><br></blockquote></div><br>Two iterations.  And since that is the only possible way to do this, you are correct, the language is terribly archaic.  I suggest you switch to Ruby ASAP.<br>

<div style id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup{position: absolute;z-index: 9999;padding: 0px 0px;margin-left: 0px;margin-top: 0px;overflow: hidden;word-wrap: break-word;color: black;font-size: 10px;text-align: left;line-height: 130%;}</style>