On 6/23/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > Hm. Did I miss something, or did we just solve builtin lookup > optimization? The only problem I see is that currently you can stick a new > version of 'len()' into a module from outside it, shadowing the > builtin. Under this scheme (of making all read-only names in a module > become closure variables), such an assignment would change the globals, but > have no effect on the module's behavior, which would be tied to the static > definitions created at import time.
Or we could arrange for such assignments to be dynamically illegal. We could have some provision whereby any name that's known to the compiler to be a built-in, and for which the compiler can't see an explicit assignment, is implicitly made static. This would make it a run-time error if "import *" were to redefine such a name. The module object would have to know which names are static and disallow assignments to these. It would also have to export __dict__ as a proxy that disallows such assignments. I think it can be made to work. I do think this would require static names as well as static expressions. This is definitely still in the brainstorm phase! -- --Guido van Rossum (home page: http://www.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