On Wed, Jan 5, 2011 at 5:27 AM, Maciej Fijalkowski <fij...@gmail.com> wrote: > How about not changing semantics and still making this optimization possible? > > PyPy already has CALL_LIKELY_BUILTIN which checks whether builtins has > been altered (by keeping a flag on the module dictionary) and if not, > loads a specific builtin on top of value stack.
I can only repeat what I said before. That's what everybody proposes, and if you have the infrastructure, it's a fine solution. But to me, those semantics aren't sacred, and I want to at least explore an alternative. Putting a hook on two dicts (the module globals and builtins.__dict__) is a lot of work in CPython, and has the risk of slowing everything down (just a tad, but still -- AFAIK dicts currently are not hookable). Checking whether there's a global named 'len' is much simpler in the current CPython compiler. -- --Guido van Rossum (python.org/~guido) _______________________________________________ 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