Making the case for repeat

Ben Finney ben+python at
Mon Jun 8 04:30:37 EDT 2009

Steven D'Aprano <steve at> writes:

> On Sun, 07 Jun 2009 16:46:23 -0700, Raymond Hettinger wrote:
> > We factor code to eliminate redundancy, but that is not always a
> > good idea with an API. The goal for code factoring is to minimize
> > redundancy. The goal for API design is having simple parts that are
> > easily learned and can be readily combined (i.e. the notion of an
> > iterator algebra).
> Wonderfully said! That has articulated something which I only recently 
> came to appreciate, but couldn't put into words.

As originally defined by Martin Fowler, re-factoring always means the
external behaviour is unchanged <URL:>.

So, there's no such thing as a re-factoring that changes the API.
Anything that changes an external attribute of the code is a different
kind of transformation, not a re-factoring.

 \          “Better not take a dog on the space shuttle, because if he |
  `\   sticks his head out when you're coming home his face might burn |
_o__)                                                up.” —Jack Handey |
Ben Finney

More information about the Python-list mailing list