On Fri, 21 Mar 2014 09:40:40 +0000, Mark Lawrence wrote: > On 21/03/2014 02:18, Chris Angelico wrote: >> On Fri, Mar 21, 2014 at 12:06 PM, Roy Smith <r...@panix.com> wrote: >>> In article <532b8f0d$0$29994$c3e8da3$54964...@news.astraweb.com>, >>> Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: >>> >>>> The rule of three applies here: anything you do in three different >>>> places ought to be managed by a function. >>> >>> I prefer the rule of two :-) >> >> The way I explain it is: Three is a rule of thumb. Sometimes it's >> blatantly obvious at two, and other times you need four or five similar >> pieces of code before you can see which part should become the >> function. If the code's absolutely identical and reasonably >> long/complex, then yes, two's all you need, but how often is that? >> Usually it's similar, rather than congruent... err I mean identical. >> That's where the third usage comes in. Or if it's maybe 2-3 lines, used >> in two places, it doesn't necessarily need to be a function. Again, a >> third usage is a strong hint that it should be broken out. >> >> The rule doesn't say that anything that *isn't* in three places yet >> should *not* be broken out. :) >> >> ChrisA >> >> > Everybody, and especially Antipodeans, knows that there is no rule 6 and > by definition what rule 7 is :)
Im sticking with rule 4 -- https://mail.python.org/mailman/listinfo/python-list