作者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://webptt.com/cn.aspx?n=bbs/Python/M.1600746030.A.C5B.html
1F:推 sherees: callable 09/22 12:13
2F:→ XperiaZ6C: 感谢大大 09/22 12:23