Scope question

Jeff Shannon jeff at ccvcorp.com
Fri Feb 8 15:00:48 EST 2002


Keith Jones wrote:

> > > from mymod import *
> > >
> > > def dosomething(x):
> > >     import mymod
> > >     mymod.dosomething(1000)
> >
> > Nope,this does not work.  As the O.P. already noted....
>
> 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.

Oh.  Duh.  Yeah, I did miss that.  :)   You're right, though, that does seem to
make the wildcard import unnecessary...  and much better avoided anyhow.

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list