PEP 285: Adding a bool type

Graham Ashton gashton at cmedltd.com
Mon Apr 8 08:06:21 EDT 2002


On Sun, 2002-04-07 at 02:51, Laura Creighton wrote:
> But we agree that refactoring is not good for its own sake, it would
> be better to have not needed the refactoring because we got it correct
> the first time.

Sure, but I'm not convinced that (in general) getting things right the
first time is an achievable goal. I suspect that (in order to achieve
maintainable code) refactoring is a must.

> But if we
> are writing functions that are to be used by others in libraries someplace,
> we have to try to minimize the effect of our refactoring on others.

A valid goal, but is it (in this case) worth the cost of legibility?
Reading between the lines on the last few posts, I'm concerned that
you're advocating code like this:

  if foo.getStatus() == 2:
      # do something

instead of:

  if foo.isValid() and foo.isPaid():
      # do something

> If other people have to refactor their code, every time that we have
> to refactor ours, they will get pissed.

If you add another return value to getStatus() they are going to have to
modify their code to make use of it, right? I don't see the problem with
making changes that will enable them to write more legible code, instead
of returning multiple values.

I don't generally write libraries for use by customers, so I'm probably
wrong...

-- 
Graham Ashton






More information about the Python-list mailing list