As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. This allows a huge amount of flexibility (letting you "reach into" someone else's function and change its behaviour), but it's flexibility that most programs use seldom if at all.
First off: Is there any way to request/cause some names to be bound early? and secondly, should there be? Argument against: Late binding is a Good Thing, and having some things bound early would be confusing. Argument in favour: Efficiency is also a Good Thing, and with staples like 'len', it's unlikely anyone will want to change them - yet the interpreter still has to do a namespace lookup every time. I would want the end programmer to have the ultimate power here (not the module designer). Something along the lines of: This global name will never change, so don't bother looking it up every time. As an example of this difference, Pike uses early binding for some things; when I did the perfect numbers testing in the other thread (discussion thread, not thread of execution!), Pike performed significantly better; I believe this is in part due to the formal declarations of variables, and the consequential simplification of local code, although since there are no globals being looked up here, there's little to be gained from those. Is this the realm of JIT compilation, or can it be done in regular CPython? Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list