MonkeeSage schrieb: > Sybren Stuvel wrote: >> Antoine De Groote enlightened us with: >>> I hope I don't upset anybody by comparing Python to Ruby (again). Is >>> there something like Ruby's retry keyword in Python? >> Please don't assume that everybody knows Ruby through and through... > > In ruby, the equivalent to try...except is begin...rescue. In the > rescue section you can ask it to retry the begin section. So, for > example: > > b=0 > begin > puts 1/b > rescue > b=1 > retry # <- this little guy > end >
Not sure I like that... begin do_something_with_sideeffects do_something_wrong rescue retry end could produce quite a bit of unexpected results if used uncautiously. Diez -- http://mail.python.org/mailman/listinfo/python-list