Objects in Python

Chris Angelico rosuav at gmail.com
Sun Aug 26 10:54:05 EDT 2012


On Mon, Aug 27, 2012 at 12:18 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Also, built-ins require a name lookup too. As you point out, locals are
> special, but Python will search an arbitrarily deep set of nested
> nonlocal scopes, then globals, then builtins.

Ah, builtins, forgot that. So yes, global scope involves potentially
two name lookups. But nonlocals aren't searched at run time.

ChrisA



More information about the Python-list mailing list