conditional print statement ?
tjreedy at udel.edu
Wed Apr 25 23:27:03 CEST 2007
"Stef Mientki" <S.Mientki-nospam at mailbox.kun.nl> wrote in message
news:2c923$462fb3e0$d443bb3a$18429 at news.speedlinq.nl...
| if Print_Info: print Datafile.readline()
| else: Datafile.readline()
Since both branches discard the data read, I presume Martin's fix is what
you really want.
| Is there a more compressed way to write such a statement,
| especially I dislike the redundancy "Datafile.readline()".
But for future reference, if you really do need to call a method in
multiple places (or even just multiple times in a loop) you can condense
dread = Datafile.readline # followed by
dread() # as needed
Terry Jan Reedy
More information about the Python-list