[Edu-sig] Re: Best approach to teaching OOP and graphics

David Handy david at handysoftware.com
Sat Mar 26 23:00:00 CET 2005


On Sat, Mar 26, 2005 at 04:51:26PM -0500, David Handy wrote:
> So I created a module called demotest that does the same thing as doctest,
> except that it prints each command and response, and it waits for me to
> press Enter before going on to the next line. I just put:
> 
>     if __name__ == '__main__':
>         import demotest
>         demotest.test()
>     
> at the bottom of my example module and it steps me through my demonstration.

Correction:

if __name__ == '__main__':
    import demotest
    demotest.demo()

(The function name is demo(), not test(). You'd think I could get my own API
right...)

David H.

> 
> If this sounds interesting, here is the link to the notes from my
> presentation:
> 
> http://trizpug.org/Members/dhandy/newclass/
> 
> and here is a direct link to my demotest module:
> 
> http://trizpug.org/Members/dhandy/demotest.py
> 
> Maybe someone else will find it as useful as I did. It requires Python 2.4
> because it uses the "advanced" doctest API: it uses DocTestFinder and
> extends DocTestRunner.
> 
> David H.


More information about the Edu-sig mailing list