PEP 3107 and stronger typing (note: probably a newbie question)

Alex Martelli aleax at mac.com
Mon Jul 2 22:11:45 EDT 2007


Donn Cave <donn at u.washington.edu> wrote:

> In article <1i0ikru.1uccqtm1efnzn3N%aleax at mac.com>,
>  aleax at mac.com (Alex Martelli) wrote:
> 
> > "Dynamic typing is recommended", they conclude, "when programs must be
> > as flexible as possible".  I recommend reading the Agile Manifesto to
> > understand why maximal flexibility is crucial in most real-world 
> > application programming -- and therefore why, in said real world rather
> > than in the more academic circles Dr. Van Roy and Dr. Hadidi move in,
> > dynamic typing is generally preferable, and not such a tiny issue as
> > they make the difference to be.
> 
> I guess there may be more than one kind of flexibility.  The language
> I fool around with sometimes that has strong static typing is Haskell.
> Though a relatively elementary Haskell programmer (the learning curve
> with this language is something you would have to experience to believe),

I do have (some of:-) that experience, and am reasonably at ease in
Haskell (except when it comes to coding monads, which I confess I still
have trouble wrapping my head around).

> I feel that the type checking actually helps me program faster.
> The compiler's check for structural correctness is after all for my
> benefit, and expedites development and maintenance of code, in my
> limited experience.  The more extensive my changes, the more useful
> the type checking is - I'm much more casual about significant code
> revision when writing in Haskell, somewhat more casual when writing
> in C, and worried when writing Python.

Eckel's and Martin's well-known essays on why good testing can replace
strict static type checking:
<http://www.mindview.net/WebLog/log-0025>
<http://www.artima.com/weblogs/viewpost.jsp?thread=4639>

Me, I'm always worried about significant code revision _unless I have
good tests in place_.  Strict static typechecks catch only a small
subset of frequent mistakes -- good tests catch a far higher quota.
Typechecks do catch some mistakes "faster", but, in my experience on
today's machines, that tiny difference is becoming insignificant,
particularly when you consider that typechecks typically require
whole-program analysis while, as Van Roy and Haridi point out, dynamic
typing affords "totally open coding".


Alex



More information about the Python-list mailing list