Limits of Metaprogramming

Wilson PaulAlexWilson at gmail.com
Mon Aug 4 12:14:04 EDT 2008


On 4 Aug, 16:50, John Nagle <na... at animats.com> wrote:
> Wilson wrote:
> > Hi all,
>
> > I have an interesting problem that I'm hoping can be solved with
> > metaprogramming, but I don't know how far Python supports code
> > generation (and I don't know if I'm taking the correct approach
> > either... hence why I'm asking on this group):
>
> > I'd like to write a program that writes/manipulates a statemachine. My
> > idea was that I would define states in a .py file along with their
> > transitions and other metadata.
>
>     You're probably better off coming up with a representation for a
> state machine (which might be a pickled collection of Python objects)
> then providing a "compile" operation which cranks out a .py file
> with code to implement the state machine.
>
>                                 John Nagle

I agree. I guess my 'representation' is the big question!

Thanks!



More information about the Python-list mailing list