Re: compiler package vs parser

2009-04-20 Thread Robin Becker
Kay Schluehr wrote: I realize that I probably ought to be trying this out with the newer ast stuff, but currently I am supporting code back to 2.3 and there's not much hope of doing it right there without using the compiler package. You might consider using the *builtin* parser module and forge

Re: compiler package vs parser

2009-04-17 Thread Kay Schluehr
> I realize that I probably ought to be trying this out with the newer ast > stuff, > but currently I am supporting code back to 2.3 and there's not much hope of > doing it right there without using the compiler package. You might consider using the *builtin* parser module and forget about the co

Re: compiler package vs parser

2009-04-17 Thread Gabriel Genellina
En Fri, 17 Apr 2009 10:55:46 -0300, Scott David Daniels escribió: Robin Becker wrote: def func(D): for k in D: exec '%s=D[%r]' % (k,k) print i, j, k print locals() print i, j, k if __name__=='__main__': func(dict(i=1,j=33)) end p.py the compiler package en

Re: compiler package vs parser

2009-04-17 Thread Scott David Daniels
Robin Becker wrote: If I have messed that up then there should be some easy fix, otherwise if pycodegen is somehow not getting the semantics of the the variables i,j correct is there some way I can fix that def func(D): for k in D: exec '%s=D[%r]' % (k,k) print i, j,

Re: compiler package vs parser

2009-04-17 Thread Aahz
In article , Robin Becker wrote: > >My analysis of the problem is that in > > start p.py >def func(D): > for k in D: > exec '%s=D[%r]' % (k,k) > print i, j, k > print locals() > print i, j, k > >if __name__=='__main__': > func(dict(i=1,j=33)) > end p.py > >the

Re: compiler package vs parser

2009-04-17 Thread Robin Becker
Kay Schluehr wrote: On 16 Apr., 11:41, Robin Becker wrote: Is the compiler package actually supposed to be equivalent to the parser module? No. The parser module creates a concrete parse tree ( CST ) whereas the compiler package transforms this CST into an AST for subsequent computations. In

Re: compiler package vs parser

2009-04-16 Thread Robin Becker
Kay Schluehr wrote: On 16 Apr., 11:41, Robin Becker wrote: Is the compiler package actually supposed to be equivalent to the parser module? No. The parser module creates a concrete parse tree ( CST ) whereas the compiler package transforms this CST into an AST for subsequent computations. In

Re: compiler package vs parser

2009-04-16 Thread Kay Schluehr
On 16 Apr., 11:41, Robin Becker wrote: > Is the compiler package actually supposed to be equivalent to the parser > module? No. The parser module creates a concrete parse tree ( CST ) whereas the compiler package transforms this CST into an AST for subsequent computations. In more recent versio

Re: compiler package vs parser

2009-04-16 Thread Robin Becker
Robin Becker wrote: Aahz wrote: In article , Robin Becker wrote: Is the compiler package actually supposed to be equivalent to the parser module? Before I poke my nose into this, what versions of Python have you tried? I'm using 2.6. I just checked and it's the same in 2.5. -- Robin Bec

Re: compiler package vs parser

2009-04-16 Thread Robin Becker
Aahz wrote: In article , Robin Becker wrote: Is the compiler package actually supposed to be equivalent to the parser module? Before I poke my nose into this, what versions of Python have you tried? I'm using 2.6. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: compiler package vs parser

2009-04-16 Thread Aahz
In article , Robin Becker wrote: > >Is the compiler package actually supposed to be equivalent to the >parser module? Before I poke my nose into this, what versions of Python have you tried? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's exp

compiler package vs parser

2009-04-16 Thread Robin Becker
Is the compiler package actually supposed to be equivalent to the parser module? I ask because the following code start p.py def func(D): for k in D: exec '%s=D[%r]' % (k,k) print i, j, k print locals() print i, j, k if __name__=='__main__': func(dict(i=1,j=33))