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?