Too many return-statements = bad style?

Terry Reedy tjreedy at
Wed Jul 14 23:53:57 CEST 2004

[snip 5 ways to process file with while loops]

"Michael Geary" <Mike at> wrote in message
news:10fb934hkq76c97 at
> do |line|
>     [ process line from file ]
> end

I presume this is equivalent to Python's

for line in file(...):

while is the proper way in Python also.  With iterators, for loops make
many awkward while loops obsolete.

Terry J. Reedy

More information about the Python-list mailing list