Visitor

1 view
Skip to first unread message

Samuel Ytterbrink

unread,
Mar 13, 2011, 9:39:25 AM3/13/11
to py...@googlegroups.com
Hi

i just wanted to show you a link and ask if this was a design issue or if you just didn't know that there are a Visitor class for the as t already.

Ondrej Certik

unread,
Mar 13, 2011, 10:46:40 PM3/13/11
to py...@googlegroups.com
Hi Sam,

On Sun, Mar 13, 2011 at 6:39 AM, Samuel Ytterbrink <nep...@gmail.com> wrote:
> Hi
> i just wanted to show you a link and ask if this was a design issue or if
> you just didn't know that there are a Visitor class for the as t already.
> http://docs.python.org/library/ast.html#ast.NodeTransformer

Yes, I know about this --- if you look at the source code, you can
see, that the implementation is so trivial, that we decided with
Mateusz to simply reimplement it, so that it can do exactly what we
want, and so that it's clear how it works (so that people don't have
to dig the source code of NodeTransformer).

But if you think you can simplify the code by using it, go ahead, I
think it's not a big deal.

Ondrej

Samuel Ytterbrink

unread,
Mar 14, 2011, 7:59:28 AM3/14/11
to py...@googlegroups.com
that was what i thought.

I only have 2 issues with the design choise. The first is that the Node Transformer has better default behavior, with the generic_visit method. And the second that the Visitor pattern isn't its own class.

I guess that it doesn't matter any more.now whne the new compiler is on its way.

Good Job every one!

keep it up

//Samuel Ytterbrink

2011/3/14 Ondrej Certik <ond...@certik.cz>



--
//Samuel Ytterbrink
Reply all
Reply to author
Forward
0 new messages