Can global variable be passed into Python function?
On Thu, 20 Feb 2014 22:37:59 -0800, Sam wrote:
> I need to pass a global variable into a python function. However, the
> global variable does not seem to be assigned after the function ends. Is
> it because parameters are not passed by reference? How can I get
> function parameters to be passed by reference in Python?
You cannot. Python does not support either pass-by-reference or pass-by-
value calling conventions. Instead, it supports the same calling
convention as Java, Ruby and other modern languages (which confusingly
those two languages both call something different), "call by object
To understand more about Python's calling convention, and why neither
call-by-reference nor call-by-value are appropriate, please read these
and also see the Wikipedia article:
If you show us a sample of your code, together of a sample of how you
expect it to work, we can suggest an alternate way to solve that problem.