作者XperiaZ6C (索尼)
看板Python
標題[問題] type hints怎麼定義函式物件
時間Tue Sep 22 11:40:28 2020
假設有個函式的參數type是str
那就宣告成 def a(b: str)
那如果參數是一個函式物件<class 'function'>呢
我用 def a(b: object) 但好像怪怪的
請問該怎麼定義比較好
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 104.133.15.101 (美國)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1600746030.A.C5B.html
推 sherees: callable 09/22 12:13
→ XperiaZ6C: 感謝大大 09/22 12:23