"import X" and "from X import y" produce different results, Why?

Fredrik Lundh fredrik at pythonware.com
Thu Mar 1 08:01:00 CET 2001


Parzival Herzog wrote:
> So, apparently the imported X is a copy of xx.X, not the same object
> by another name.

it's another *reference* to the same object, not a copy.

I suggest reading up on Python's object semantics:

    http://effbot.org/guides/python-objects.htm

and maybe also:

    http://effbot.org/guides/import-confusion.htm

Cheers /F

<!-- pythonworks 1.2 coming soon:
http://www.pythonware.com/products/works/index.htm
-->





More information about the Python-list mailing list