finding objects in a piece of functional code ?
Stefan Behnel
stefan_ml at behnel.de
Sun Apr 11 10:24:03 EDT 2010
Stef Mientki, 10.04.2010 18:08:
> I would like to translate some functional description into some standard
> class object,
> so it can be used as a basic building brick into a larger piece of code.
>
> Suppose the functional description is:
>
> Name = 'Test_Function'
> Out = 3 * In
Ok, so you want to implement a domain specific language (DSL) for function
post conditions.
First thing to ask: how expressive do you want this language to be? If the
answer is "as expressive as the code it describes", then you will end up
needing a turing-complete programming language, in which case you may want
to use plain Python code instead of writing your own language. See the
doctest module.
Implementing a language that can express "x*3" is relatively(!) easy, but I
would guess that you want your post conditions to be a little more
expressive than that.
Could you describe why you want such a language in the first place? What
feature do you need that cannot be expressed using doctests, for example?
Stefan
More information about the Python-list
mailing list