看板 Python 關於我們 聯絡資訊
如何能在不執行某函數的狀況下, 以程式判斷此函數含有yield? (即此函數可以成為iterator) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.20.60.207
mythnc:type(function()) ? 12/02 23:05
yjc1:keyword: decompile, func_code, co_code, opcode, opname 12/02 23:38
ykjiang:Catch errors rather than avoiding them 12/03 00:19
ykjiang: to avoid cluttering your code with special cases. 12/03 00:20
ykjiang:inspect.isgenerator(object) 12/03 00:40
rexrainbow:感謝ykjiang, inspect.isgeneratorfunction 12/03 11:17