[Python-Dev] Recent experience with the _ast module (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Thu Feb 15 07:58:51 CET 2007
- Previous message: [Python-Dev] Recent experience with the _ast module
- Next message: [Python-Dev] Recent experience with the _ast module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] Recent experience with the _ast module
- Next message: [Python-Dev] Recent experience with the _ast module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]