Python Productivity over C++
Hung Jung Lu
hungjunglu at hotmail.com
Fri Jun 9 14:54:50 EDT 2000
--- In python-list at egroups.com, "M.-A. Lemburg" <mal at l...> wrote:
>Steve Mullarkey wrote:
> > 3. I use incremental compiling and linking. This reduces wait times to
> > very small amounts.
> > > 4. I can also use background compiling and linking.
>
>Python compiles on-the-fly at run-time and only if needed.
>You can even program interactively and have the program
>compile its own code.
I really have to raise my voice here: in Python, running means also
compiling. Steve: sorry to point this out to you, but you really ought to
take a look at dynamical reloading of modern script languages like Python.
To me, that's the biggest advantage of modern script languages. In Python,
there are no separate commands for compiling and running. And you can reload
a Python module on the fly. Do you understand that? For many applications
(like webservers), it is absolutely crucial that the main application keeps
running while you are adding/modifying part of the program. That's an area
where C++ can not do well. In Python, I often have programs running, and
then I need to modify part of the program. I go ahead and modify the module,
and since I have designed the main program to reload the submodules, I never
have to stop the main application, this even if there are compiling/runtime
errors from the submodule. Doing that in C++ is an absolute nightmare.
Python not only does incremental compiling and linking, it does it in REAL
TIME. You can modify your program while it is running. This is absolutely
critical for applications like webservers: you don't want to stop the main
application because you want to change one line of code. This is a
tremendous time saving over the traditional compile-run-debug,
compile-run-debug, compile-run-debug,... cycles. In Python, it was more
like: debug-click, debug-click, debug-click,... cycle. I just can't imagine
how I was going to do the same thing in C++ within the same time frame. I
would say that 10 times shorter development time is probably an
understatement in that particular case. In my case, it was between a
possible project and an impossible project.
The biggest advatages of script languages are that they make dynamic
reloading easier and they offer reflection (or introspection): the language
is capable of looking into itself, and even perform meta-programming. I know
you can make your C++ program to do this kinds of things, but you have to
spend a tremendous amount of development time before you can reach some
minimum features of dynamic reloading and reflection. (I have also used Java
reflection features, but Python's reflection is way simpler and superior.)
When you have dynamic reloading, designing GUI in Python is still not as
comfortable as in Visual Basic, but darn close.
I worked for a multimedia CD-ROM game company before, and it really sucked
to use C++ or Java because of the lack of dynamic reloading. Programmers
waste too much time in the compiling process. With Python, you can have the
application running, find out the bug, fix it, and all while the game is
still running. Too bad I already changed job.
Hung Jung
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
More information about the Python-list
mailing list