如何经过引用传递变量? - How do I pass a variable by reference?

问题:

The Python documentation seems unclear about whether parameters are passed by reference or value, and the following code produces the unchanged value 'Original' Python文档彷佛尚不清楚参数是经过引用仍是经过值传递,而且如下代码产生不变的值“原始” spa

class PassByReference:
    def __init__(self):
        self.variable = 'Original'
        self.change(self.variable)
        print(self.variable)

    def change(self, var):
        var = 'Changed'

Is there something I can do to pass the variable by actual reference? 我能够作些什么来经过实际引用传递变量吗? .net


解决方案:

参考一: https://stackoom.com/question/48VK/如何经过引用传递变量
参考二: https://oldbug.net/q/48VK/How-do-I-pass-a-variable-by-reference
相关文章
相关标签/搜索