[Python-Dev] Two laments about CPython's AST Nodes
fwierzbicki at gmail.com
Fri Aug 21 15:46:35 CEST 2009
On Thu, Aug 20, 2009 at 6:11 PM, "Martin v. Löwis"<martin at v.loewis.de> 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 to follow the lead. If I had a private
AST and and a public mirror for ast.py, the design could become much
simpler, and probably faster for normal parsing.
> If you are asking that a type check is made on assigning a value to
> these fields - I'm not quite sure whether you could implement that
> check reliably. Wouldn't it be possible to bypass it by filling a
> value directly into __dict__?
> If you can come up with a patch that checks in a reliable manner,
> I would be in favor of adding that (in 2.7 and 3.2), taking out
> the corresponding checks when converting to the internal AST.
Great, I may give it a try, but changing the AST impl for Jython 2.6
will probably be my short term answer.
More information about the Python-Dev