Re: [Python-3000] __builtin__ and __builtins__

2007-03-12 Thread Brett Cannon
On 3/12/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 3/12/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Ka-Ping Yee wrote: > > > > > We have "import as", though. If you want to import the default > > > builtins without using them as the builtins, you can say > > > > > > import __builti

Re: [Python-3000] __builtin__ and __builtins__

2007-03-12 Thread Guido van Rossum
On 3/12/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Ka-Ping Yee wrote: > > > We have "import as", though. If you want to import the default > > builtins without using them as the builtins, you can say > > > > import __builtin__ as default_builtin > > Seems to me it would be better to rename th

Re: [Python-3000] __builtin__ and __builtins__

2007-03-12 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mar 12, 2007, at 6:12 PM, Greg Ewing wrote: > Seems to me it would be better to rename the module > to a non-double-underscore name. There's really nothing > magical about the module itself, only the name used > by global variable lookups. So just

Re: [Python-3000] __builtin__ and __builtins__

2007-03-12 Thread Greg Ewing
Ka-Ping Yee wrote: > We have "import as", though. If you want to import the default > builtins without using them as the builtins, you can say > > import __builtin__ as default_builtin Seems to me it would be better to rename the module to a non-double-underscore name. There's really nothin

Re: [Python-3000] __builtin__ and __builtins__

2007-03-12 Thread Guido van Rossum
This is all my fault. Long ago, there was only __builtin__, and all was well; you had to import it before using it. Then I added __builtins__ as an internal hook for restricted execution mode. The idea was that if __builtins__ was set to something nonstandard you were automatically in restricted

Re: [Python-3000] __builtin__ and __builtins__

2007-03-11 Thread Ka-Ping Yee
On Mon, 12 Mar 2007, Greg Ewing wrote: > Changing __main__ to match would seem to be a > good idea. [...] > There might be merit in renaming __builtins__ > to something less confusable, at the expense of > breaking existing code which refers to it. Cool. > I don't think it would be such a good

Re: [Python-3000] __builtin__ and __builtins__

2007-03-11 Thread Greg Ewing
Ka-Ping Yee wrote: > A little investigation reveals: > > In module __main__: > __builtins__ is a reference to module __builtin__. > __builtin__ only exists if you import it. > > In any other module: > __builtins__ is a reference to module __builtin__'s __dict__. >

[Python-3000] __builtin__ and __builtins__

2007-03-11 Thread Ka-Ping Yee
For a long time __builtin__ and __builtins__ have mystified me. Usually I end up guessing -- in any given namespace, one of the two will exist, and it will either be a module or a dictionary -- but I never committed to memory which name or type to expect. A little investigation reveals: In mo