[Python-Dev] Recent experience with the _ast module

Brett Cannon brett at python.org
Wed Feb 14 01:40:56 CET 2007


On 2/13/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Brett Cannon wrote:
> > On 2/12/07, Collin Winter <collinw at gmail.com> wrote:
> > > 2) {BinOp,AugAssign,BoolOp,etc}.op
> >
> > I can't think of a reason, off the top of my head, why they can't be
> > singletons.
>
> Why not just use interned strings?
>

Because the AST code at the C level represent the 'op' value as
basically an enumeration value, not a string.  So creating an object
is somewhat easier then trying to do the conversion to an interned
string.  Or at least I suspect; Martin can tell me I'm wrong if I am.

-Brett


More information about the Python-Dev mailing list