Testing dynamic languages

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Apr 4 21:57:15 CEST 2009

> If I am writing in Python, since it is dynamically, but strongly
> typed, I really should check that each parameter is of the expected
> type, or at least can respond to the method I plan on calling ("duck"
> typing). Every call should be wrapped in a try/except statement to
> prevent the method (and program) from crashing when my method is
> called with an integer instead of the expected string.

Others have already given you most of the answers (summary: don't do
that. Don't fight the language. Use doctests). My other suggestion is
to read code coming from 5+ Python programs written by other
(different) people. You will see how to use Python.


More information about the Python-list mailing list