Python debugger help + anecdote

Gerry Stringer (gerry@camscan.co.uk)
Wed, 8 Dec 93 16:15:52 GMT

I'm almost too embarrassed to ask but how do I use the Python debugger
class? I've written database backup/restore utilities which I need to
debug. At the moment they're written so that the wrapper script does
python -c 'import utility' ie. I haven't put the code neatly into a
'main' procedure to call. Does this affect debugging in any way?

Python Anecdote
-----------------

As a plug for Python, I originally started writing the scripts in Perl,
I worked around Perl's limited data structuring capabilities and it
sort of worked OK. As part of the backup I create a BACKUPLOG file
containing schema information such as table names, no of rows in a
table, table fields etc.

Clearly, the backup & restore utilities had a lot of common code to
fill/write schema data structures which could be made into a Perl
library. The crunch came when I suddenly got the requirement to be able
to merge two backups. In Python I just create two instances of a
BACKUPLOG object filled from the logs and merge them naturally into a
third instance to be saved. The Perl code just wasn't easy to adapt
to the new situation.

Someone else might have been able to solve this in some better way, 4 years
of C++ have probably biased my solutions but there are still other
advantages of Python in that it has a very clear, easily maintainable
style and exception handling is a joy to use. Perl still has the edge
(IMHO) for certain tasks because it has more 'builtins' as standard -
with all that implies and Perl version 5 improves things a lot. I'll
probably still use Perl for my installation scripts or maybe ...

many thanks,

gerry (gerry@camscan.co.uk)