list/tuple to dict...

Donn Cave donn at
Thu Sep 16 19:16:24 CEST 2004

In article <roy-F19881.09301016092004 at>,
 Roy Smith <roy at> wrote:

> aleaxit at (Alex Martelli) wrote:
> > Copy and paste is a BAD way to reuse software.  Very, very bad.  Anybody
> > with the least experience maintaining big programs will confirm.
> Absolutely agree.
> A while ago, I was working on a piece of code written by somebody who 
> didn't believe in this.  I found a bug and fixed it.  Sometime later, we 
> realized the fix was wrong and I went back to make an additional change.
> I was surprised when the file I was looking at appeared to be the 
> original code.  Where had my first change gone?  We spent an afternoon 
> looking through CVS logs, getting ourselves more and more convinced that 
> CVS had somehow messed up.
> It turns out, the fix I made was in a huge function (100's of lines) 
> which somebody had cut-and-pasted to make three versions which did 
> almost identical things.  And then they gave the functions almost 
> identical names, along the lines of:
> sendMessageToServerWithAlertCondition ()
> sendMessageToServerWithErrorCondition ()
> sendMessageToServerWithOtherCondition ()
> So, yeah, Alex is right.  Don't do that.

Sure, don't do _that_.  But do you think anyone might be
able to come up with cases where software has been unnecessarily
fragile because of a compulsive desire to avoid repeating a
line of similar code anywhere?  Don't do that, either!

   Donn Cave, donn at

More information about the Python-list mailing list