[Python-ideas] Retrying EAFP without DRY

Jim Jewett jimjjewett at gmail.com
Wed Jan 25 16:42:31 CET 2012


On Tue, Jan 24, 2012 at 12:18 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> ... I've written for loops with an unconditional break at the end to
> get "0 or 1" iteration.

Ouch ... That seems even worse than the C do {...} while (0); idiom.

Why didn't you just use an "if"?  (Or at least a try ... except StopIteration)

-jJ



More information about the Python-ideas mailing list