while true: !!!

deadmeat root at []
Mon Dec 18 21:33:26 CET 2000

> This is precisely where having assigment as an expression (like C/C++)
> is useful :
> while ( (line = file.readline()) != None ) :

yuk.. I'd prefer the Pascal way to C's

while file.readline(line) do
 // whatever

however I don't know if variables passed to Python functions can be altered?

> while ( file.exists_next_line() ) :
> line = file.readline()
> do something with the line

I'd go for that.

however the file reading thing is just one example of while 1: so being able
to avoid it in this case is hardly any breakthough.

More information about the Python-list mailing list