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

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu Jun 21 10:58:37 EDT 2007


Peter Decker a écrit :
(snip)
> Oh, c'mon. The OP was asking for an explanation, and got an indignant
> response. There is a world of difference between explaining *why*
> Python is the way it is, and getting the equivalent of a 4-year-old's
> "Because!" as a reply.

<because mode="40-years-old">
Python is the way it is because the creator of the language decided to 
make it so.
</because>

More seriously, wrt/the dynamic vs static typing religion war, any 
developer familiar with usenet should be able to find endless threads 
covering the topic, so I don't see any need for one more.

> To someone who admits that he is largely unfamiliar with the language,
> it would seem obvious that Python is "lacking" something that is
> important in other languages.

To someone who is only familiar with declarative static typing. One can 
be unfamiliar with Python but familiar with one (or more) of the many 
other dynamic languages around...

> An explanation as to why this would be
> Bad Thing for Python would be a helful response.

Did you actually bother to read the full answer ? If so, you missed the 
explanation, so let's quote it:

"""
Given that one can add/replace/remove methods and attributes
dynamically either on a per-class or per-instance basis, and even
dynamically change the class of an object, I fail to see how static
typechecking could be meaningfull.
""

It seems obvious from this that static typecheking would require 
dropping all dynamism from Python - then turning it into another, very 
different (and mostly useless as far as I'm concerned) language. IOW : 
you can't have Python *and* static typechecks - both are mutually 
exclusive. Hence my answer : if you want static typecheking, you'll have 
to use another language - one way or another.




More information about the Python-list mailing list