[Tutor] Why a global?
alan.gauld at btinternet.com
Thu Dec 28 17:15:31 CET 2006
"Carlos" <carloslara at web.de> wrote
> Sheesh, that solved it, guess that I got to learn OO next. Unles it
> not related... :-[
The problem you had was about reassigning a name from a
module to an object, but it could have been any kind of
object - a variable, a function, another module, anything.
So really it had nothing to do with OO.
If you do:
import sys as s
s = 42
you will get an error because you renamed sys to s then
used s as a local varuiable, thus overwriting (and thus losing)
the module reference. You need to ensure that your names
More information about the Tutor