MRAB wrote:
Scott David Daniels wrote:
Bruno Desthuilliers wrote:
d = {}
for line in open(thefile):
   arr = line.strip().split()
   d[arr[0]] = arr

Sorry, not picking on Bruno in particular, but I keep seeing
this formulation around various places.
When does line.strip().split() ever differ from line.split()?
... <explanation of what split does>

You misunderstand the question.  For what values of line is
the following expression False?

    line.strip().split() == line.split()

If you know of one, I'd like to hear of it.  If not, I assert
that (baring some incredibly over-ambitous optimizer operations)
    line.strip().split()
is simply an inefficient (both performance and text) way of saying:
    line.split()

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to