[Python-ideas] Retrying EAFP without DRY (original) (raw)
Stephen J. Turnbull stephen at xemacs.org
Mon Jan 23 05:34:44 CET 2012
- Previous message: [Python-ideas] Retrying EAFP without DRY
- Next message: [Python-ideas] Retrying EAFP without DRY
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan writes:
On Mon, Jan 23, 2012 at 7:30 AM, Mike Meyer <mwm at mired.org> wrote:
or wrapping a loop around the code when it wasn't really a loop.
You want to do the same thing more than once: that's a loop.
That's a question of point of view. If "thing" is thought of as a "try" (an operation that might fail), yes, he wants to do the same thing a nondeterministic number of times, and in general, more than once: it's a loop. If "thing" is thought of as a "block" (which isn't a try), then the "things" done with and without exception are different: it's not a loop, it's a conditional.
Looking at his example "superficially" (I intend no deprecation by that word, just a point of view in looking at the code), I have some sympathy for Mike's claim that "it's not a loop and it violates DRY." I "know what he means" (and I bet you do, too!) However, when I try to define that, even informally, I arrive at the paragraph above, and I end up coming down on the side that you can't consistently claim that "it's not a loop" and claim that "it violates DRY", in some deeper sense.
- Previous message: [Python-ideas] Retrying EAFP without DRY
- Next message: [Python-ideas] Retrying EAFP without DRY
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]