breaking up is hard to do

bbands bbands at yahoo.com
Fri Mar 25 15:37:29 EST 2005


I've a 2,000 line and growing Python script that I'd like to break up
into a modules--one class alone is currently over 500 lines. There is a
large config.ini file involved (via ConfigParser), a fair number of
passed and global variables as well as interaction with external
programs such as MySQL (via MySQLdb), R (via Rpy) and gnuplot (via
Gnuplot). Every time I have tried to break it up I end up with thorny
name-space problems and have had to stitch it back together gain. Any
pointers to materials on how best to modularize a script such as this
would be appreciated. I'd like to end up with most of the code in
modules and with just the main logic and housekeeping stuff in the main
module.

John

PS The script works fine as is and I am a very happy and productive
camper with Python. I was a BASIC user for many years who switched to
Python a year and a half ago rather than moving to .NET.




More information about the Python-list mailing list