not safe at all

Dirck Blaskey dirck at pacbell.net
Sat Jul 14 02:11:59 EDT 2001


"Dennis Roark" <denro at earthlink.net> wrote in message
news:u26ukt4vot7b1qu02hkp8l1pnmdi0sfp3l at 4ax.com...
> Python is an attractive language.  But for a large program I
> would still rather be forced to declare the name of a
> variable (and its type) rather than risk misspelling or
> misuse 500 lines later in the program.  My original note was
> not intended to be an indictment of Python, but only to
> bring up some reasons that for me make more strongly typed
> languages like C++ or Object Pascal better at coding very
> large projects.

And now that you're completely overwhelmed by the response,
here's yet-another-something-to-consider:

Static/strong typing and type safety are of great use - to a *compiler*.
C/C++/Pascal, etc.  could not do what they do, or do it as well,
without knowing this information.  They create a functioning program
out of raw hardware: memory & cpu, and they have to keep track
of every bit, or the program won't run.  A smart compiler can optimize
your code as well, but only because it knows what's what.

The Python compiler doesn't have this restriction, because Python
runs on a virtual machine made out of much smarter components.
The components 'know' what they are, the compiler doesn't have to.

There is a school of thought that strong typing is extremely important
for program 'correctness'.  What everybody here is saying, basically,
is that there are a lot more important considerations when it
comes to making a program correct, and they all have enough real
experience in this area for you to take their argument seriously.

A non-trivial program cannot ever be 'proven' correct anyway;
Computers are inherently chaotic systems, and the 'state space'
of a complex running system is practically infinite.

Make sure all the pieces are as good as you can make them,
(or perhaps just as good they need to be,) and use that as your
base of confidence that the program will work as well as necessary.

There are very few problem domains where perfection is a requirement,
notably anything involving potential loss of human life.  These domains
require unusual and exceptional techniques to ensure high quality.
As an experienced programmer, I know I would never want to work
on anything where a coding mistake could kill someone.  It does happen.

Just to belabor the point a bit more.

d






More information about the Python-list mailing list