status of Programming by Contract (PEP 316)?

Russ uymqlp502 at
Fri Aug 31 01:54:14 CEST 2007

Bruno Desthuilliers wrote:
> Russ a écrit :
> > On Aug 28, 10:58 pm, Michele Simionato <michele.simion... at>
> > wrote:
> >
> >
> >>Why do you think that would ad a strong positive capability?
> >>To me at least it seems a big fat lot of over-engineering, not
> >>needed in 99% of programs. In the remaining 1%, it would still not
> >>be needed since Python provides out of the box very powerful
> >>metaprogramming capabilities so that you can implement
> >>yourself the checks you need, if you really need them.
> >
> >
> > I get the strong impression you don't really understand what
> > programming by contract is.
> I get the strong impression you don't really understand how
> condescending you are.

When someone writes something as ignorant as that, they need to be
called on it.

So you can implement everything you need already in Python? Yes, of
course, and you
can do it in machine language too -- if you have the time to waste.

> > I have not yet personally used it,
> You have no working experience with the concept, but you think it should
> make it into Python's core ???

I don't need to use it to understand the concept. That has been
brilliantly by the Eiffel and SPARK Ada folks.

I am also smart enough to figure out that
it can greatly enhance unit testing, and it can also be used as an
integral part of unit testing.
Once you have the conditions in place, all you need to do in your unit
tests is to send inputs
to the unit and wait to see if exceptions are thrown.

In fact, I would even propose a new name for "programming by
contract." I would call it
"self-testing code" because the code essentially tests itself every
time it is run with the
checks activated.

More information about the Python-list mailing list