Special-purpose extension of Python -- new kinds of objects

David C. Fox davidcfox at post.harvard.edu
Mon Dec 29 11:35:14 EST 2003


Robert Dodier wrote:

> Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:
> 
> 
>>robert_dodier at yahoo.com (Robert Dodier) writes:
>>
>>>  # "dn" == "decision network", an Ephemeral construct;
>>>  # this part is parsed separately from the python code
>>>  dn my_example:
>>>    chance X:
>>>      cpd: gaussian [mean: 25, std_dev: 75]
>>>    chance Y:
>>>      cpd: gaussian [mean: 12, std_dev: 19]
>>>    chance Z = X + Y
>>
>>I don't see what good this does.  You can do the same thing with
>>ordinary Python classes.
> 
> 
> Thanks for your interest. I want to make it possible to experiment 
> with notations that don't correspond to Python syntax. For example, 
> to write "X ~ gaussian(mu,sigma2)", or to write "Y <- (X1, X2, X3)",
> say.
> 
> The larger goal is to make the decision model description as
> natural as possible for people that work on decision problems. 
> Development effort should focus on the decision model, which,
> in interesting problems, may be much larger and more complex 
> than the ordinary Python glue code around it.

Personally, I would first write all of the code for performing 
calculations in pure Python, using the usual OO notation.  Then you can 
always add a parser which translates the mathematical syntax into OO.

David





More information about the Python-list mailing list