[Python-ideas] Retrying EAFP without DRY

Jim Jewett jimjjewett at gmail.com
Tue Jan 24 02:13:29 CET 2012


On Mon, Jan 23, 2012 at 8:06 PM, Mike Meyer <mwm at mired.org> wrote:
> On Tue, 24 Jan 2012 11:00:53 +1100
> Steven D'Aprano <steve at pearwood.info> wrote:
>> I don't. To me, "retry this thing repeatedly" is fundamentally a loop.

> What's being abstracted out isn't "retry this thing repeatedly".  it's
> "I want to retry this thing after tweaking things if it fails." In
> particular, different ways of failure might require different tweaks
> before the retry, second failures would be handled differently from
> first failures, etc.

So it doesn't seem like a loop because you hope to do it only once?

Or because you're thinking of the thing-retried as the candidate loop,
when that is just a constant function, and actual the loop is a loop
over things-to-try-first (a loop over functions, rather than data)?

-jJ



More information about the Python-ideas mailing list