如何判断一个函数是否是一个特殊的 generator 函数?可以利用 isgeneratorfunction 判断:

>>>from inspect import isgeneratorfunction 
>>> isgeneratorfunction(fab) 
False

 

相关文章: