[Python-projects] Assertions, type checking, and testing

David G. Wonnacott davew at cs.haverford.edu
Thu Jun 22 15:29:59 CEST 2006


Thanks, Aurélien, Maarten, and Nicolas, for your sketching out of a
way to do the kind of assertions I'd like to do; I've got to focus on
some revisions of a paper that's due tomorrow, but want to look at the
paper Marc mentioned and the details of your ideas as soon as I can.

I am definitely planning to use Pylint; I should have made it clear in
my original posting, but that is what got me reading the logilab
mailing list in the first place. If students start using this from day
1 this will hopefully help train them in good style as well as help
catch their errors.


In response to your rant, I agree that exceptions and testing don't
get the respect they deserve when we teach CS. I wouldn't say that
most _intro_ courses are too focused on formal proofs and invariants;
there seem to be some that focus on formality at the expense of
programming skill, and others (especially here in the U.S.) that focus
on programming skills without as much of a foundation as I'd like to
see.

We're trying to strike a balance in which we give the students some
moderately challenging programming exercises (with a minimal number of
language features) that illustrate the value of various foundational
skills involving thinking about algorithm design and programming in
terms of _both_ proofs and testing. I hope to find a way to work in
exceptions in the 1st semester rather than the 2nd or (as we have it
now) the 3rd, but there are only so many things that can come first!

Dave W

>  Date: Wed, 21 Jun 2006 18:39:11 +0200
>  From: =?iso-8859-1?Q?Aur=E9lien_Camp=E9as?= <aurelien.campeas at logilab.fr>

...

>  <small rant>
>  
>  The exception handling system is an important part
>  of modern languages, and while it is not of strict algorithmic
>  interest, it is of utmost importance for the practical developper,
>  with respect to program robustness. (this is slightly off-topic but I
>  am quite annoyed that exception handling receive so little academic
>  interest - in the context of teaching at least - and formal proofs and
>  invariants the lion's share; they are almost equally important, and
>  while a real-world program may not retain most of its invariants
>  checking (for performance reasons typically), it must be able to
>  handle errors gracefully; not all errors can be caught by formal
>  proofs, far from it).
>  
>  <.../>
>  
>  Also, you should have a looke at Pylint (and use it!)
>  ... (http://www.logilab.org/projects/pylint). It will also notify you
>  about what it considers (and much in the Python community consider)
>  good/bad style.
>  


More information about the Python-Projects mailing list