Python Success Stories or Nightmares

Ben Wolfson wolfson at uchicago.edu
Sun Feb 2 21:26:33 EST 2003


On Sun, 02 Feb 2003 18:11:53 -0800, Paul Rubin wrote:

> Alexander Schmolck <a.schmolck at gmx.net> writes:
>> Well, given that there simply *is* no reason to "miss that one-liner" you
>> mention above -- as it would just provide an idiotic way to write:
>> 
>>  for line in file:...           # doesn't need more RAM BTW
>> 
>> --  what did you expect?
> 
> How would you write
> 
>    while ((c = getc(file)) != EOF)
>        ...
> 
> without missing the one-liner?

for c in iter(lambda: file.read(1), ''):
   ...

-- 
I certainly seem to be enjoying myself in the same way, smacking my
lips, sighing and moaning, dripping [REDACTED] on my shirt and
smearing it into my moustache ... But ... If I snuck a lick of your
cone, I wouldn't smack my lips. -- Ted Cohen





More information about the Python-list mailing list