PEP 42 and Py2.1

Raymond Hettinger othello at javanet.com
Mon Mar 19 13:38:59 EST 2001


Tim Peters wrote:

> [Raymond Hettinger]
> > I've checked out the Py2.1 beta and my most desired small feature didn't
> > make it.  To quote PEP 42:
> >
> >     Generalize eval() to accept any mapping objects for locals and
> >     globals.
> >
> > Is it too late to get this one in?
>
> Yes; it was too late the day after 2.1b1 was released (the first beta has the
> last new feature).

Bummer.

>
> > Is it difficult to implement?
>
> Afraid that's the wrong question:  resistance has been grounded in "go fast"
> reasons.  Using dicts directly avoids the runtime expense of indirecting thru
> an abstract mapping-object layer.

I'm suprised.  Keeping dictionaries as a special case gives:
       if type(localarg) = type({}):                        # one test in C can't
eat many cycles
            do it the way it's done now
       else:
            do it through mapping object indirection.

> > Is there anyway I can help get it done?
>
> Well, implementing it would be a help!  Then you can quantify the slowdown
> (if any -- who knows?).

I'll take a crack at it.

> personally-doubt-it-would-make-make-enough-difference-to-care-ly

>     y'rs  - tim

Raymond




More information about the Python-list mailing list