Dom Grigonis writes:

 > Why would this not be a good option? 1 extra line compared to
 > walrus, but no DRY issue.
 >   with open(“fn") as f:
 >     while True:
 >         line = f.readline()
 >         if line and check(line):
 >             process(line)
 >         else:
 >             break

Works for me.  I suspect you can construct situations where it would
be a lot uglier.  But I'm not a fan of the walrus in the first place,
so I'm not going to take this any further.

Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ATQJORWTV5PJ2Z43FIPP5E2Z4GZWQGAS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to