各位大大好,
請教以下程式碼為什麼不管呼叫test多少次
m陣列中都只有註冊到一次
該怎麼理解
謝謝~
m=[]
def register(f):
m.append(f)
return f
@register
def test():
pass
print m # m=[<function test at 0x7f24a6c76488>]
test()
print m # m=[<function test at 0x7f24a6c76488>]
-----
Sent from JPTT on my iPhone
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.73.204.203
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1536302876.A.C14.html
→
09/07 15:24,
6年前
, 1F
09/07 15:24, 1F
→
09/07 17:33,
6年前
, 2F
09/07 17:33, 2F