
15 Jul
2009
15 Jul
'09
3:54 p.m.
On Wed, Jul 15, 2009 at 3:50 PM, Jan Kaliszewskizuo@chopin.edu.pl wrote:
Hello,
The issue has been coming back repeatedly:
How we could elegantly and pythonic'ly avoid repeating ourselves if we need the control flow structure that e.g. in PASCAL has the form:
repeat ... until CONDITION
In Python we must use while-loop in not very DRY (Don't Repeat Yourself) manner:
SOME ACTIONS HERE ... while CONDITION: THE SAME ACTIONS AGAIN ...
You can fix that by just writing it as:
while True: SOME ACTIONS HERE if not CONDITION: break
Cheers, Chris