question about shadowing built-in names
John Salerno
johnjsal at NOSPAMgmail.com
Tue May 23 11:43:26 EDT 2006
I understand that if you reassign a built-in name to your own variable,
such as:
str = 'hello'
then you lose the use of the built-in (in this case str()), but is this
also the case in terms of imported names? For example:
import MySQLdb
db = connect(blah blooh blee)
cursor = db.cursor()
Now, in the above, did I reassign the value of the cursor method, or is
this different?
Actually, now that I think about it, that's not exactly the same because
cursor is a method of a connection object, not simply a function. So I
suppose my real question is, does the 'shadowing' of built-in names also
happen when you import other names, whether they are functions,
methods or whatever else they could be?
Thanks.
More information about the Python-list
mailing list