[Python-ideas] Retrying EAFP without DRY

Mike Meyer mwm at mired.org
Tue Jan 24 06:47:21 CET 2012

Nick Coghlan <ncoghlan at gmail.com> wrote:

>On Tue, Jan 24, 2012 at 2:44 PM, Mike Meyer <mwm at mired.org> wrote:
>> That using an LBYL idiom, or simply repeating yourself, means you
>don't need a loop says to me that it isn't really a loop.  Which is why
>using loop to write it feels wrong.
>The argument that it might be worth having dedicated syntax for a loop
>that runs 1 or 2 times is rather unconvincing when we don't even have
>dedicated syntax for a loop that runs 1 or more times (see PEP 315).

The argument isn't that we need a new syntax for a small set of loops, it's that the only ways to implement retrying after an exception leave a code smell.
Sent from my Android tablet with K-9 Mail. Please excuse my brevity.

More information about the Python-ideas mailing list