question about shadowing built-in names

John Salerno johnjsal at NOSPAMgmail.com
Tue May 23 18:39:39 CEST 2006


Dennis Lee Bieber wrote:

>> import MySQLdb
>>
>> db = connect(blah blooh blee)
> 
> 	Actually, the above has already failed <G> Should be
> MySQLdb.connect...

Heh heh, yeah, I totally meant to do that on purpose. ;)


> 	Well, if you have a habit of doing
> 		from module import *
> and later rebind one of the imported names...

I see. So doing a regular import <name> statement keeps the namespace 
confined to that module, right? So I would be able to create my own 
variable with the same name as a name in the imported module, and this 
wouldn't be a problem as long as I didn't import with *?



More information about the Python-list mailing list