On Mon, Jan 17, 2022 at 07:19:17AM -0800, Jelle Zijlstra wrote: > > That is in the global scope, which will be much slower than a local scope. > > Global builtins do a hash table lookup; local lookups just follow a > pointer.
Yes, that is correct, frozenset is a builtin, not a local variable, so looking the name up does two hash table lookups: one in globals, and if the name hasn't been shadowed, a second in builtins. -- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/EMSUSD73ALYS3CTOLMUSCMM7SQCJIN6D/ Code of Conduct: http://python.org/psf/codeofconduct/