Can global variable be passed into Python function?
ned at nedbatchelder.com
Fri Feb 21 13:13:25 CET 2014
On 2/21/14 2:23 AM, dieter wrote:
> Sam<lightaiyee at gmail.com> writes:
>> >I need to pass a global variable into a python function.
> Python does not really have the concept "variable".
> What appears to be a variable is in fact only the binding of an
> object to a name. If you assign something to a variable,
> all you do is binding a different object to the name.
Man, do I hate this idea that Python has no variables. It has variables
(names associated with values, and the values can change over the course
of the program), they just don't work the same as C or Fortran
Python's variables are names bound to values.
http://nedbatchelder.com/text/names.html has lots more details.
Ned Batchelder, http://nedbatchelder.com
More information about the Python-list