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

Steve Holden steve at
Mon Jul 2 23:51:21 CEST 2007

Donn Cave wrote:
> In article <1i0ikru.1uccqtm1efnzn3N%aleax at>,
>  aleax at (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 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.
> This is the kind of flexibility where you make significant changes
> to something, but the result is as structurally consistent as it
> would have been if written that way from the start.  I have also
> seen the kind of flexibility where you use expedient hacks to make
> changes with relatively small amounts of code, and I've seen it in
> Python applications.  It's flexibility when you're doing it, but
> it paradoxically causes rigidity as the hacks create more points
> of articulation and more things that aren't obvious to the person
> making the changes.  If that's flexibility, you can have it.
Indeed you describe an arthritic design quite well, but I don't think 
it's fair to single Python out as a potential problem. As we have known 
for a long time you can write unstructured code in almost any language, 
and you can do structured programming in almost any language given 

I certainly agree that if the programmer shows insufficient discipline 
the results will likely be bad, but in that light Haskell is really the 
ultimate bondage language. Some of us don't like to be tied that tightly.

I don't feel the same trepidation you appear to do when refactoring 
Python code. I suppose I might say that in my experience Python allows 
you to appreciate a better-engineered solution more easily, and so it 
tends to encourage better engineering.

In some ways C# is quite Python-like, and I am beginning to enjoy 
writing it from time to time, but when you are dealing with amorphous 
collections the casting and conversions can drive you almost insane. And 
since the collections are ultimately collections of Object, none of it 
actually gets you any nearer your programming goal.

Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd 
Skype: holdenweb
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

More information about the Python-list mailing list