Why does Dynamic Typing really matter?!?

Alex Martelli aleax at aleax.it
Thu Feb 6 10:11:13 EST 2003


Cameron Laird wrote:
   ...
> All true, of course.  I'll dramatize this in what strikes me
> as Maoist rhetoric:  we support dynamic typing not to change
> types, but to ignore types.  Types are a false overdetermin-

Good point!  It's rare (though interesting) to want to CHANGE
a given object's type -- for an interesting simple case see:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68429
(BTW, despite the doubts expressed in comments, the approach
does work with new-style classes too, to some extent).

but, it's not a deep and desperate need anyway (I do not know
of any case where I'd suffer a BIG loss of productivity if it
was impossible to change an object's type on the fly, _IF_
the whole system uses signature-polymorphism as below).


Relying on signature polymorphism instead of types is FAR more
frequent -- thus "ignoring types" in some sense except for
their signatures.  C++'s templates are a decent example IMHO
(syntactically not so good, complicated, limited, but still a
decent example of the power of signature polymorphism).  When
I was getting started with Python (as a C++ expert) there was
a "feeling" to it, for me, AS IF I was getting all of the good
things of templates without needing any effort to get them;-).


> ation, as, at an earlier time and at a lower level, memory
> addresses were.  Memory and type management are just two of
> several functions best left to the computer, so that coders
> can concentrate on application-level concepts.

Good parallel.  Of course in both cases I want to be able to
recover some control -- e.g. to check for memory leaks, or
to debug the cause of some type-error -- but by default and
most of the time, being able to avoid the issue helps;-).


Alex





More information about the Python-list mailing list