Question about import

Mark Daley mark at diversiform.com
Tue Aug 5 19:42:40 CEST 2003


The difference is how you access the methods in the module.  If you use:

import Module

you will only be able to use the Module.Method usage.  If you use:

from Module import *

you can access the Methods directly.


The drawback to using from Module import * comes from conflicts if you
import multiple Modules, which may have identically named Methods, where you
will only be able to get the Method from the most recently imported Module.
Better to import the Module, IMO.

Any thoughts, all?

- Mark

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Kevin MacKenzie
Sent: Tuesday, August 05, 2003 9:29 AM
To: python-list at python.org
Subject: Question about import


I'm a complete newbie to using Python.  I have a small question about
importing modules.

Is there any difference between the two following statements, and what
(if any) are they?

>>> from Module import *


and

>>> import Module


Thanks.

kjm
--
http://mail.python.org/mailman/listinfo/python-list







More information about the Python-list mailing list