On Wed, Apr 25, 2018 at 2:23 AM, Steven D'Aprano <st...@pearwood.info> wrote: > On Tue, Apr 24, 2018 at 11:25:58AM -0400, Yury Selivanov wrote: > >> No, it doesn't. The check is performed during compile phase, and >> Python does not unroll loops. Anyways, read below. > > What does unrolling loops have to do with anything? And besides, loop > unrolling is an implementation detail -- maybe Python will unroll loops, > maybe it won't. > > If you insist that the check is only done at compile time, then your > description is wrong and your rule that "it is *not* allowed to mask > names in the current local scope" is false. It *is* allowed to shadow > names in the local scope, but only names that cannot be determined at > compile-time. > > from math import * > process(arg, (pi = 1), pi+1) # allowed > > That's more and worse complexity.
That's not allowed at local scope (at least, it's not allowed at function scope - is there any other "local scope" at which it is allowed?). Not sure if you can craft equivalent shenanigans with 'exec'. ChrisA _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com