1
参数是有可能追加到一个默认的函数参数或从外部获取函数参数的值?追加到默认的功能
例如:
def foo(bar, foo="baz"):
print(bar, foo)
foo("hello", "world") # print "hello world"
foo("hello", foo="world") # print "hello world" as well
foo("hello") # print "hello baz"
foo("hello", foo<append it>"bla") # how? want to print "hello bazbla"
print("default value of foo's foo parameter:", [magic here])
我不认为这是一个很好的做法,但我很好奇。
有什么错调用'FOO( “你好”, “bazbla”)'?你想修改函数本身吗? – bereal
[获取函数参数的默认值?]的可能重复(http://stackoverflow.com/questions/12627118/get-a-function-arguments-default-value) –