Confused with module and .py files
Fredrik Lundh
fredrik at pythonware.com
Wed Oct 5 04:57:26 EDT 2005
"Iyer, Prasad C" wrote:
> How would I use it if I declare it as given below in my 3rd class
>
> from import1.py import *
> from import2.py import *
thats a syntax error; I assume you meant
from import1 import *
from import2 import *
which simply doesn't work if you need to access things that happens
to have the same name in both modules.
it's like typing
a = 1
a = 2
and then asking how you can access the original 1 via the "a" variable.
so unless you know *exactly* what you're doing, you should *never*
use "from import *" -- unless you're using a module that someone else
wrote, and the documentation for that module tells you do use it.
see http://effbot.org/zone/import-confusion.htm for more on this.
(see other replies for how to do what you want in a way that actually
works).
</F>
More information about the Python-list
mailing list