[Python-ideas] Retrying EAFP without DRY

Ethan Furman ethan at stoneleaf.us
Tue Jan 24 20:16:47 CET 2012

Mike Meyer wrote:
> On Wed, 25 Jan 2012 05:37:07 +1100
> Steven D'Aprano <steve at pearwood.info> wrote:
>> You can't know that the loop will run once until you actually try.
> Which is not a code smell. However, if you can tell by reading the
> code that it will only run once (or never run), like this one:
>      for i in range(1):
> Then it's a code smell!

Absolutely.  But your retry may run through twice.  :)


More information about the Python-ideas mailing list