[Python-Dev] Recent experience with the _ast module
"Martin v. Löwis"
martin at v.loewis.de
Thu Feb 15 07:58:51 CET 2007
Collin Winter schrieb:
> What's inconsistent about it? That classes are being used for the
> _ast.{Add,Sub,Mult,etc} names?
Exactly. These aren't names - they are nodes in the tree. All nodes
are instances of _ast.AST.
> I don't see the need for both _ast.Add and _ast.Add.singleton or
> _ast.add or however else it might be spelled. I'd be perfectly happy
> doing something like "_ast.Add = object()" (when initializing the _ast
> module), so long as I can write "node.op is _ast.Add", "node.op ==
> _ast.Add", or something equally brief and to-the-point.
Would you like to do the same for Pass, Break, Continue, and Ellipsis?
They are also "just names". If you make _ast.Add the entry in the
tree itself, why not _ast.Break? Or, if you have a way to deal with
_ast.Break, why can't the same way work for _ast.Add?
Regards,
Martin
More information about the Python-Dev
mailing list