On 2/14/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Collin Winter schrieb: > > 2) It turned out that {BinOp, BoolOp,AugAssign,etc}.op were already > > singleton instances of their respective classes. I've changed > > asdl_c.py to no longer emit the *_singleton names and to use the > > corresponding *_type types in their place, which will enable me to > > write "node.op is _ast.Add", etc. > > I don't really like this - it's inconsistent. I'd rather prefer > if the singletons where exposed under a name, e.g. > _ast.Add.singleton, or _ast.add (if that doesn't cause conflicts).
What's inconsistent about it? That classes are being used for the _ast.{Add,Sub,Mult,etc} names? 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. Collin Winter _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com