PyWart: Namespace asinitiy and the folly of the global statement

Chris Angelico rosuav at gmail.com
Fri Feb 8 02:28:18 EST 2013


On Fri, Feb 8, 2013 at 6:23 PM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
>      from builtins import print, len, repr
>      from builtins import *  # This is not recommended!
>
> This would serve two purposes (1) the reader would know which builtins where being used in this module (2) the names would be bound properly to the module namespace. But this does not answer your question, merely a side note
>
> So your assertion is wrong. Built-ins /would/ be available at the module level with no qualification just as they are now. But they would also be available in /every/ namespace because how else would we use them Chris?

So what you're saying is that builtins are available without
qualification inside a function, but other names imported into the
module namespace aren't? MAGIC.

ChrisA



More information about the Python-list mailing list