Is mymodule.myvariable a 'global'? (What is proper definition of 'global variable'?)

S

seberino

Python lets me access module level variables from *anywhere*. All I
have
to do is add module name in front.

e.g.

mymodule.myvariable

Is this considered a 'global'? Or, does a 'global variable' have to be
accessible anywhere *without* a namespace in front?

(I'm not sure what proper academic definition of 'global variable' is.)

Thanks!

Chris
 
M

Michael Ekstrand

Python lets me access module level variables from *anywhere*. All I
have
to do is add module name in front.

e.g.

mymodule.myvariable

Is this considered a 'global'? Or, does a 'global variable' have to
be accessible anywhere *without* a namespace in front?

Whether or not it is a true academic global, such a variable is what
Python calls a global. There is no way to make a variable universally
accessible without a namespace.

-Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top