Scope question

Keith Jones kmj9907 at cs.rit.edu
Fri Feb 8 10:59:38 EST 2002


> > from mymod import *
> >
> > def dosomething(x):
> >     import mymod
> >     mymod.dosomething(1000)
>
> Nope,this does not work.  As the O.P. already noted....
>
...
>
> from module import *  does not create a reference to module in the current
> namespace, so there's nothing there to look up attributes from.
>

did you miss the fact that he's importing mymod in the function?  'Course,
based on the example, then, the 'from mymod import *' is unnecessary, I
would think.

--
-Keith Jones
http://www.codeexamples.org






More information about the Python-list mailing list