dynamic typing questions

Terry Reedy tjreedy at udel.edu
Sun Dec 21 12:45:46 EST 2003


"Jason Tesser" <tesserfamily at yahoo.com> wrote in
message
news:mailman.352.1071846222.9307.python-list at python.org...
> The other programmer here is very concerned
about
> dynamic typing though in Python.  He feels like
this
> would be too much of a hinderance on us and too
easy
> for us to make a mistake and not catch it until
> runtime making debugging harder.

One problem with static typing is that the type
you want is too often not one of the types you
have immediately available.  It may be a subset or
union thereof.  If log(-1.0) passes the compiler,
then you get a runtime crash that is at most as
graceful as Python's default traceback.  If log(1)
does not pass the compiler (if it does not
autocast to float), then you are delayed until you
stick in the 'missing' decimal point.

The corresponding advantage of Python's dymanic
typing is that functions are generic; they work
with any data that works and is not specifically
excluded.  C preprocessor text macros such as
(untested, written from years ago memory)

#define max(a,b) ((a) > (b) ? (a) : (b)) /* beware
of double side-effects */

that implement generic pseudofunctions testify to
the usefulness of this.

Terry J. Reedy






More information about the Python-list mailing list