import from question
bignose+hates-spam at benfinney.id.au
Wed Jan 16 09:19:30 CET 2008
Tobiah <toby at tobiah.org> writes:
> This is a little surprising. So "from mod import *" really copies
> all of the scalars into new variables in the local namespace.
No. Nothing is copied. All the objects (remembering that in Python,
*everything* is an object) created by the code in module 'mod' are
given names in the current namespace.
> I always ASSumed that the two forms of import were equivalent, but
> that one form did away with the need to be explicit about the
> namespace: mod.thing Obviously this is far from the case.
Yes. In fact the main difference is in what namespace the module's
objects are made available.
\ "The way to build large Python applications is to componentize |
`\ and loosely-couple the hell out of everything." -- Aahz |
More information about the Python-list