Adding static typing to Python

Gerhard Häring gerhard at bigfoot.de
Mon Feb 18 19:50:19 EST 2002


Peter Milliken wrote in comp.lang.python:
> There is no such effort to my knowledge. There is a tool called PyChecker
> that attempts to fill the gap, I have no experience with it though.
> 
> The loose typing of Python is perceived as one of its big features :-).
> There are regular discussions on the usefulness of Python for "larger"
> projects. Many claim that they use it without any problems - I suspect that
> it is from a background of ignorance and lack of metrics i.e. how much time
> is lost in their projects to misnamed variables etc? The only way in Python
> to find these is through (exhaustive) testing - such rigorous testing
> *requires* you to develop an exhaustive test suite that is capable of
> running periodically i.e. nightly etc to catch such errors. Whether the
> people who support Python for larger projects have the discipline within
> their project team to maintain such an effort is unclear - there has been no
> mention of it at all. So I doubt that the proponents of Python in these
> instances have any idea of the true cost of this language "feature" - they
> appear to be wound up in how quickly they can produce a working prototype
> (or whatever) so I suspect their day to day work involves very small,
> manageable projects where the lost efficiency due to loose typing isn't
> really that noticable for them i.e. they "live with it" :-).
> 
> Personally, I have used Python for several small, personal projects and the
> odd "script" that searches text files - even here, the only perceived
> advantage is the library support, I often wonder whether I wouldn't be
> better off using my real language of choice (Ada) because of it's strong
> typing -

Ada 95 is also one of my favourite languages, but I've never used it
for a real project (well, I once tried it use it for putting my
gateway computer online/offline, until I realized that Annex E wasn't
supported on the win32 version of GNAT :-( ).

> it too has interfaces to the standard GUI tools etc.

Yet the number of libraries is much smaller than for Python. There are
some nice data structure libraries and a nice COM binding, but I found
it much too exhausting to try to get the Ada libraries to work. For
example, there is AdaSockets for raw network programming, but the
Python standard library has implemented most of the interesting
protocols already, so Python is more usable out of the box for most of
my networking needs.

> My next personal project will not be in Python, it is a "cute"
> language and allows some nice facilities i.e. creating a script at
> run-time and then running it can be very powerful in the correct
> circumstances - so I will probably use an Ada-Python API for these
> situations and get the best of both worlds :-).

Perhaps you will find http://pyada.sf.net/ useful. It's a project I
started once for no good reason :-) It's now more or less
unmaintained.

> When I compile a Ada program cleanly I know that 95% of the bugs are
> out of it - before I even start testing! :-) Of course, it takes me
> longer to write up front but overall development effort (in my
> subjective opinion - since I have no metrics :-)) is that it is much
> lower.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list