Can global variable be passed into Python function?

Marko Rauhamaa marko at pacujo.net
Sun Feb 23 10:52:05 CET 2014


Steven D'Aprano <steve+comp.lang.python at pearwood.info>:

> The big difference is that in "fixed location" languages, it makes
> sense to talk about the address of a *variable*.

The address could be a symbol, too.

The Python statement

   xyz = 3

places a number in the address "xyz".

You can read the value from the address "xyz" with

   locals()["xyz"]


Marko



More information about the Python-list mailing list