Re: dict is really slow for big truck
- From: MRAB <google@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Apr 2009 21:54:25 +0100
Scott David Daniels wrote:
MRAB wrote:From the explanation it's clear that the .strip() is unnecessary.Scott David Daniels wrote:Bruno Desthuilliers wrote:... <explanation of what split does>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()?
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()
.
- References:
- Re: dict is really slow for big truck
- From: Scott David Daniels
- Re: dict is really slow for big truck
- Prev by Date: command prompt history filtered by initial letters
- Next by Date: Re: Silent install of Python software(2.5) for windows.
- Previous by thread: Re: dict is really slow for big truck
- Next by thread: Re: dict is really slow for big truck
- Index(es):
Relevant Pages
|
Loading