Using Python as script extension

Helmut Jarausch jarausch at skynet.be
Fri Jul 18 15:13:51 EDT 2003


Bob van der Poel wrote:
> 
> 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.
> 

Being a Python newbee my, I'd suggest having a look at

  http://www.alcyone.com/pyos/empy/

it looks as if it is what you are looking for.



-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany





More information about the Python-list mailing list