[Steven Elliott] > As you probably know each access of a builtin requires two hash table > lookups. First, the builtin is not found in the list of globals. It is > then found in the list of builtins.
If someone really cared about the double lookup, they could flatten a level by starting their modules with: from __builtin__ import * However, we don't see people writing this kind of code. That could mean that the double lookup hasn't been a big concern. > Why not have a means of referencing the default builtins with some sort > of index the way the LOAD_FAST op code currently works? FWIW, there was a PEP proposing a roughly similar idea, but the PEP encountered a great deal of resistance: http://www.python.org/doc/peps/pep-0329/ When it comes time to write your PEP, it would helpful to highlight how it differs from PEP 329 (i.e. implemented through the compiler rather than as a bytecode hack, etc.). > Perhaps what I'm suggesting isn't feasible for reasons that have already > been discussed. But it seems like it should be possible to make "while > True" as efficient as "while 1". That is going to be difficult as long as it is legal to write: True = 0 Raymond _______________________________________________ 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