Adding static typing to Python

Magnus Lyckå magnus at thinkware.se
Tue Feb 19 19:10:48 EST 2002


"Milliken, Peter" <Peter.Milliken at GTECH.COM> wrote in message news:<mailman.1014084270.25240.python-list at python.org>...
> I haven't tried any other
> strongly typed language than Ada, so my statements are necessarily limited
> by that background.

Then I can understand that you come to another
conclusion than those who come from a C/C++
background.

I've only used ADA in school, and that was in the
late 80's, but I can certainly say that the static
typing in ADA is much better than the C/C++ variant.

I've just toyed with Java, so I don't know that well
enough to judge.

Of course, you can always define classes to restrict
value sets and limit confusion, but classes are a bit
of overkill for simple values that don't represent any
unique objects. (I mean, from a design point of view,
a car is an object, its maximum speed is not, it's an
attribute of the car, whether speed is implemented as
a class or not.)

> The original post states that the typing of Java was
> perceived as a distinct advantage, so presumably the level of type checking
> there is enough to request the feature in Python. 

But still he used Python instead of Java, since he
had given up on having Java do this text processing.

Since there is no such thing as a Python with Java typing
we don't know if such a thing would be even better. It
is easy to imagine a percieved gain from such a change,
but it's not so easy to predict all the consequences
such a change would cause.

Even if Python is really simple to learn, it does require
a slightly different mindset than C++ or Java, and that
takes a while. It seems that people worry less about static
typing the more they use Python. Sure, humans are very
adaptable, and can get used to almost anything, but I don't
think people would get more and more relaxed about this if
it really caused a lot of problems.

I mean, I've used Windows for more than a decade, I only 
got more and more frustrated with it for each month that 
passed. It's better now, but that's just partly because I
"got used to it", and due to improvements from Microsoft.
The 2 main reasons I can live with Windows are Python and
Cygwin's unix tools.

With C++ new stumble blocks seemed to crop up as I got over
the initial ones. There's a reason there are books like Scott
Meyer's "Effective C++" series that spends 100's of pages on
handling quirks in the pure core of the languare. Python books
can spend less on such things, and instead describe the rich
library.

There were never any major frustrations with learning Python,
and having programmed Perl for less than a year I was more
productive in Python than in Perl in days, but of course we
tend to aquire certain mindsets. Last summer I tried to do
some Perl programming, and it was a rather bad experience. I
was thinking in Python and trying to coax that to Perl. It 
just didn't work...



More information about the Python-list mailing list