The Difference between Import and From??

Fredrik Lundh effbot at telia.com
Tue Mar 14 17:36:18 EST 2000


Akira Kiyomiya <akira.kiyomiya at autodesk.com> wrote:
> I have a feeling that I am confused of how Python imports a file.   Maybe
> the difference between import and from??

it's more likely that you haven't realized that simple
assignments modify names, not objects.

in other words, "from small import x, y" makes the local
"x" point to the same object as "small.x", but the "x = 42"
statement changes "x" so it points to an integer object.

for more information on imports, start here:
http://www.pythonware.com/people/fredrik/fyi/fyi06.htm

</F>





More information about the Python-list mailing list