I come not to bury C++, but to praise it...

Valentino Volonghi aka Dialtone dialtone#NOSPAM#.despammed at aruba.it
Fri Jan 16 18:47:45 EST 2004


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

> Python may have stricter dynamic typing than C++ has
> static typing, but that's hard to quantify.  On the
> other hand, Python has no static typing at all.  There
> is no way to tell it ``this function must be applied
> to a string and must return an int.''  If applied to
> a list instead, there's a non-trivial chance it will
> manage to do something absurd with it.  If it returns
> None under certain circumstances, there's a non-trivial
> chance that value will be stashed away somewhere and
> you'll later wonder where the heck that None came from.

You clearly don't know enough of python to talk like this about the
language features...

You need static typing (why then... I cannot see any good reason,
anyway...)? Well then, use pyrex. You'll find yourself writing code
like this:

cdef int a, b
def sum(int a, int b):
    return a+b

Then using pyrex parser you would build a python extension module
which you will compile it. If you do errors using types it will catch
it. Anyway there's no need to use this stuff... absolutely no
reasonable need. Except if you need a lot of speed and you need to
implement an algorithm directly in C using native C types and not
python objects.

-- 
Valentino Volonghi, Regia SpA, Milan
Linux User #310274, Gentoo Proud User



More information about the Python-list mailing list