Re: while c = f.read(1)
- From: Mike Meyer <mwm@xxxxxxxxx>
- Date: Mon, 22 Aug 2005 14:28:58 -0400
"Greg McIntyre" <greg@xxxxxxxxxxxx> writes:
> My files are large, hence 1 character at a time, not f.read().
There are alternatives between the two. You could read in a chunk of
reasonable size for your platform. Say 10meg on a recent workstation,
or 100meg on a current workstation.
> This is code from another employee and I'm just in the stages of going
> through it and doing a basic clean-up before I get on to a proper
> efficiency assessment, hence I don't want to change the way it works,
> just make it as short and lucid as I can.
Well, the thing that has been hinted around but not explicitly stated
is that doing thing one character at a time in Python is a "code
smell", by which I mean it's an indication that there could be a
better way to do things, and it's probably worthwhile spending a
little time looking for it. On the other hand, if you've already
planned another pass over the code, that might be the time to look
into this.
<mike
--
Mike Meyer <mwm@xxxxxxxxx> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
.
- Follow-Ups:
- Re: while c = f.read(1)
- From: Greg McIntyre
- Re: while c = f.read(1)
- References:
- while c = f.read(1)
- From: Greg McIntyre
- Re: while c = f.read(1)
- From: Bengt Richter
- Re: while c = f.read(1)
- From: Greg McIntyre
- while c = f.read(1)
- Prev by Date: Re: global interpreter lock
- Next by Date: setup install question
- Previous by thread: Re: while c = f.read(1)
- Next by thread: Re: while c = f.read(1)
- Index(es):
Relevant Pages
|