Re: dict is really slow for big truck
- From: Scott David Daniels <Scott.Daniels@xxxxxxx>
- Date: Wed, 29 Apr 2009 13:07:03 -0700
MRAB wrote:
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()
--Scott David Daniels
Scott.Daniels@xxxxxxx
.
- Follow-Ups:
- Re: dict is really slow for big truck
- From: MRAB
- Re: dict is really slow for big truck
- Prev by Date: Re: Would you support adding UNC support to os.path on Windows?
- Next by Date: Re: import and package confusion
- 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