Moving from PHP to Python. Is it Possible

Nobody nobody at nowhere.com
Sun Dec 13 20:44:46 EST 2009


On Fri, 11 Dec 2009 12:26:30 +0200, Sancar Saran wrote:

> 1-) Can I create Global (read/write access anywhere from my code) Multi 
> dimensional, associative array (or hash) and store any kind of variable type. 

Global, no; at least not in the sense of e.g. C. Python doesn't have a
global namespace; the highest level is a module.

Read/write from anywhere in your code, yes. You just need to decide which
module to put the variable in, then import that module (or even the
specific variable) from the other modules.

E.g. you can have a file state.py containing nothing but:

	state = {}

Other modules can then use:

	from state import state

to make the variable visible.




More information about the Python-list mailing list