Re: while c = f.read(1)



"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.
.



Relevant Pages

  • Password Policy Help
    ... set GPO for Workstations to require 5 minimum ... I log into a test workstation, ... Minimum character setting is present. ... local policy still shows it's getting the 5 character minimum from the Domain ...
    (microsoft.public.windows.group_policy)
  • Re: NK.BIN distribution
    ... The only way we have to actually load the image onto our platform is to ... But when we hit the production we need to be able to do the same without ... Can the ethernet tool, used for downloading the nk.bin from the PB, be ... workstation, allowing them to update the platform with the nk.bin? ...
    (microsoft.public.windowsce.embedded)
  • Re: Cool, thanks! But, question remains...
    ... You just need to find out if they're using a Roman or Cyrillic ... character set. ... convert from ISO-8859-2 (Central/Eastern European.) ... > data on the Workstation is because the Workstation has been configured as ...
    (microsoft.public.pocketpc.developer)
  • Re: NK.BIN distribution
    ... I ran into a bit of trouble last week since our new platform dont have any ... But when we hit the production we need to be able to do the same without ... Can the ethernet tool, used for downloading the nk.bin from the PB, be ... workstation, allowing them to update the platform with the nk.bin? ...
    (microsoft.public.windowsce.embedded)
  • Re: Spec ECUs
    ... Microsoft Server 2008 set up as a workstation as a platform and it is almost ... in fact it could almost tempt me into ditching Linux. ...
    (rec.autos.sport.f1)