[issue2505] Restrict attributes of _ast nodes

Martin v. Löwis report at bugs.python.org
Sat Mar 29 15:49:18 CET 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

> On second thought, restricting node attributes may prevent custom AST
> processing tools from adding useful information themselves...

Indeed. If anything is to be checked, it should be whether the child
nodes or attributes have the right types. However, that should rather
be done in a recursive check function on _mod, which then would also
check whether all necessary fields have been set. Or, such checks
could be delayed until actual compilation of the tree is attempted
(i.e. conversion to the C AST structures).

As for being able to pass constructor arguments: I'd expect them
to be positional arguments, not keyword arguments - anybody creating
AST nodes would normally have Python.asdl open, no?

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2505>
__________________________________


More information about the Python-bugs-list mailing list