Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-21 Thread Frank Wierzbicki
On Thu, Aug 20, 2009 at 6:11 PM, "Martin v. Löwis" wrote: > Couldn't you just generate a check function for your tree that > would be invoked before you try to process a tree that a > script got access to? That would be one way, though now that I understand CPython's AST design better, I am tempted

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-20 Thread Martin v. Löwis
> x = compile("def foo():pass", "foo", "exec", _ast.PyCF_ONLY_AST) > > Does x contain real AST nodes or does it contain mirror structures > (feel free to just tell me: don't be lazy, go read the code). It only contains a mirror structure. See pythonrun.c:Py_CompileStringFlags, and the (generated)

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-20 Thread Brett Cannon
On Thu, Aug 20, 2009 at 06:20, Frank Wierzbicki wrote: > On Wed, Aug 19, 2009 at 5:00 PM, "Martin v. Löwis" wrote: >>> Now on to the complaints: Though I recently added support for this in >>> Jython, I don't like that nodes can be defined without required >>> attributes, for example: >>> >>> node

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-20 Thread Frank Wierzbicki
On Wed, Aug 19, 2009 at 5:00 PM, "Martin v. Löwis" wrote: >> Now on to the complaints: Though I recently added support for this in >> Jython, I don't like that nodes can be defined without required >> attributes, for example: >> >> node = ast.Assign() > > I think we disagree in two points in our ev

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-19 Thread Martin v. Löwis
> Now on to the complaints: Though I recently added support for this in > Jython, I don't like that nodes can be defined without required > attributes, for example: > > node = ast.Assign() I think we disagree in two points in our evaluation of this behavior: a) ast.Assign is *not* a node of the

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-19 Thread Benjamin Peterson
2009/8/19 Frank Wierzbicki : > Before I start complaining, I want to mention what a huge help it has > been to be able to directly compare the AST exposed by ast.py in > making Jython a better Python.  Thanks for that! > > Now on to the complaints: Though I recently added support for this in > Jyth

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-19 Thread Brett Cannon
On Wed, Aug 19, 2009 at 11:10, Frank Wierzbicki wrote: > Before I start complaining, I want to mention what a huge help it has > been to be able to directly compare the AST exposed by ast.py in > making Jython a better Python.  Thanks for that! > > Now on to the complaints: Though I recently added