Scope question
Paul Rubin
phr-n2002a at nightsong.com
Thu Feb 7 20:09:45 EST 2002
"MDK" <mdk at mdk.com> writes:
> > from mymod import *
> > mymod_dosomething = dosomething
> >
> > def dosomething(x):
> > mymod_dosomething(1000)
> >
> > Neal
>
> Neat! Thanks, Neal.
Alternatively, in Python 2.x,
from mymod import dosomething as mymod_dosomething
Generally, it's best to avoid "from mymod import *", precisely
because of collisions like this. As other people have mentioned, it's
better to say
import mymod
def dosomething(x):
mymod.dosomething(1000)
More information about the Python-list
mailing list