does lack of type declarations make Python unsafe?

Alexander Schmolck a.schmolck at gmx.net
Thu Jun 19 21:57:49 EDT 2003


jjl at pobox.com (John J. Lee) writes:

> David Abrahams <dave at boost-consulting.com> writes:
> 
> > Brandon Corfman <bcorfman at amsaa.army.mil> writes:
> > 
> > > I think the problem is that a C++/Java programmer regards the Python
> > > command prompt as little more than a calculator or a place to type
> > > "prog.main()". I know I did at first.
> > 
> > Ever try to write a class with more than 2 methods at the
> > command-line?  After screwing it up several times I always revert to
> > emacs <wink>.
> 
> I agree with this.  I don't know what all the fuss is about with the
> interactive prompt. 

Maybe you're just not using it in the most effective manner (possibly because
your problems don't profit that much from it).

>  I certainly do use it, quite frequently, but
> don't see a huge difference here between Python and statically-typed
> compiled languages (especially given a good IDE -- like unix + emacs
> etc.).

What good IDEs do you have in mind? The only ones I've ever seen are for
dynamically typed languages such as smalltalk.

If you essentially just emulate write-compile-run cycles with python you might
not notice that much of a difference to a statically typed mainstream language
such as C++ or Java.

But believe me, there is a *huge* difference between being for example able to
interactively explore and modify some complicated data or code and not being
able to do so.

> 
> Maybe only me and David make lots of mistakes at the interactive prompt ;-)

The idea is not to write the bulk of your code in an interactive prompt -- the
idea is to write the bulk of your code with your editor/IDE whatever and then
have it evaluated in a running interactive session upon keypress. If something
goes wrong the debugger should automatically pop up and go to the matching
source code line. You can than look at and interact with live objects in the
debugging session to find out what's going wrong, fix the piece of code in
your editor and evaluate it (and not the whole program) again. If you want to
see or edit the source code for some object it only takes a single short
command. Writing test code also becomes much more fun.


'as




More information about the Python-list mailing list