do ... while loop
Aahz Maruch
aahz at netcom.com
Wed Oct 13 21:08:19 EDT 1999
In article <7u374b$8lm$1 at netnews.upenn.edu>,
Joshua Marcus <josh at linc.cis.upenn.edu> wrote:
>
>What is the %$*&@#!@ rationale behind not including a do...while control
>structure in Python?
>
>I know you can simply work around it, e.g:
>
>line = "foo"
>while input != "":
> line = fp.readline()
> process(line)
What you really want is
for line in fp.readlines() :
process ( line )
There's the little matter that readlines() sucks the entire file into
memory, but it's great if you can live with that overhead. There's also
a pending task to make it optionally "lazy", but that probably won't
happen until 2.0.
--
--- Aahz (@netcom.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6 (if you want to know, do some research)
More information about the Python-list
mailing list