我有這樣的功能:將Python函數作爲參數傳遞而不執行它?
def a(one, two, the_argument_function):
if one in two:
return the_argument_function
我the_argument_function看起來是這樣的:
def b(do_this, do_that):
print "hi."
兩個以上的被導入到一個文件「main_functions.py」我的最終代碼看起來像這樣:
print function_from_main(package1.a, argument, package2.b(do_this, do_that)
的「如果一兩」,從「一」功能的作品,但傳遞給「function_from_main」無は當「b」功能仍然執行從「a」檢查它是否應該執行。
我該怎麼辦?
你叫'B'明確的條件時,如何它會*不*執行? – timgeb
@timgeb你完全理解我的問題。現在呢,我該如何讓它不能執行? –
不叫它.. – timgeb