Python suitability

skaller skaller at maxtal.com.au
Sat Dec 25 18:12:28 EST 1999


Darrell wrote:

> The quality of our code for the second release was vastly better than the
> first. Learning to write good Python took a while.
> 
> Some things I noticed that effect most everything.

	I wonder how your comments would be modified if you
separated 'Python' from 'the current CPython implementation':
 
> 1. Deciding on a directory structure ...

	Agree. Design problem in general, only partly relating
to python.

> 2. Memory management is easy, but test for memory leaks.
>     Or just massive memory usage. It's easy to eat huge amounts of
>     memory or for some module to tuck away references that can't be freed.

	Partly an artefact of CPython 1.5.2's use of reference counting:
Viper and JPython use a real garbage collector.
 
> 3. Slicing and dicing huge strings is a performance problem. 

	An artefact of CPython 1.5.2. Viper is _specifically_
designed to make string manipulation much faster. Those 'good python'
tricks you've probably used will make it much harder for the
compiler to optimise string performance. The 'a+b+c' form is 
the easiest to optimise.

> 4. Exceptions, error messages and debug control were vastly improved
>     in the second release. My first attempt was just way too complicated.
>     Python lends it's self to simple solutions, that aren't always obvious
>     to a the reformed C++ developer.

	:-)
 
> 5. We have only one C++ extension module even though I wanted to
>     write more. Seems that what we have is fast enough, at least for
>     what they want to pay.

	My recommendation is: if you really have to write C/C++ modules
for performance -- make sure you keep the python script version up
to date semantically. When a script compiler becomes available,
you may be able to abandon your hand written C/C++ code in favour of it.
 
> 6. Many of the things you do in C++ are to over come it's own
>     limitations.

	The main limitation of C++ wrt python is the ugly syntax,
and the quantity of it that is required to do something which is
simple in Python. After all, Python is written in a subset of C++.
Python simply 'pre-makes' some design decisions for you.
This is an advantage if these decisions suit your application,
and a hassle if they don't, and you have to work around them.

> Go for it, but remember there are no silver bullets, software is hard.

	Design is hard, yes.

-- 
John Skaller, mailto:skaller at maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850




More information about the Python-list mailing list