Python out params?

Nic*_*ner 1 python

有可能做这样的事情:

def foo(bar, success)
    success = True
    # ...

>>> success = False
>>> foo(bar1, success)
>>> success
True
Run Code Online (Sandbox Code Playgroud)

Python有没有params,或者是一种简单的方法来模拟它们?(除了弄乱父母的堆栈帧.)

zne*_*eak 6

您有多个返回值.

def foo(bar)
    return 1, 2, True

x, y, success = foo(bar1)
Run Code Online (Sandbox Code Playgroud)