Using Python as script extension

Bob van der Poel bvdpoel at kootenay.com
Fri Jul 18 14:20:55 EDT 2003


I'm looking for some suggestions on a project I'm working at these days...

I've written my program "Musical MIDI Accompaniment (MMA)" which parses 
a text file and generates MIDI output. I've written this in Python, and 
all works very nicely. See http://www.kootenay.com/~bvdpoel/music.html

Now, I am thinking that adding variables and conditional (if/then/else) 
possiblities to MMA scripts might be a good thing. If I want to do this 
I see several possible routes:

1. Add the code to maintain and set variables to my existing code. This 
always seems to end up being a lot more work than one plans. Certainly, 
adding a command like "Set MyVariable 123" is simple enought, but then 
the next thing you know one will be adding math, etc.

2. Somehow having Python handle the dirty stuff. I guess that my "Set 
MyVariable 123" could be passed along to Python with an eval or exec. 
However, I'm not sure how much help this would be since we still end up 
with having to write code to handle if/then/else.

3. Somehow turn my MMA scripts into python scripts and extend python to 
generate the stuff which my program originally set out to produce. This 
would involve a major rewrite of my own code and most likely send my 
exsiting MMA scripts into the dumpster...

And I'm sure I'm missing yet another solution. I'd really appreciate 
some thoughts and/or ideas on how I might approach this.

Thanks.

-- 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bvdpoel at kootenay.com
WWW:   http://www.kootenay.com/~bvdpoel






More information about the Python-list mailing list