[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can global variable be passed into Python function?

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 
variables. In fact, they work exactly the same as Javascript or Ruby 

Python's variables are names bound to values.
http://nedbatchelder.com/text/names.html has lots more details.

Ned Batchelder, http://nedbatchelder.com