parallel class structures for AST-based objects

Steve Howell showell30 at yahoo.com
Sat Nov 21 19:18:47 EST 2009


On Nov 21, 4:07 pm, MRAB <pyt... at mrabarnett.plus.com> wrote:
>
> I don't see the point of EvalNode and PrettyPrintNode. Why don't you
> just give Integer, Sum and Product 'eval' and 'pprint' methods?

That's a good question, and it's the crux of my design dilemma.  If
ALL I ever wanted to to with Integer/Sum/Product was to eval() and
pprint(), then I would just add those methods to Integer, Sum, and
Product, and be done with it, as you suggest.  But what happens when
somebody wants to extend capability?  Should every future software
developer that wants to use Integer/Sum/Product extend those classes
to get work done?  What if they want to store additional state for
nodes?




More information about the Python-list mailing list