inspection.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:qcore 作者: quora 项目源码 文件源码
def is_cython_or_generator(fn):
    """Returns whether this function is either a generator function or a Cythonized function."""
    if hasattr(fn, '__func__'):
        fn = fn.__func__  # Class method, static method
    if inspect.isgeneratorfunction(fn):
        return True
    name = type(fn).__name__
    return \
        name == 'generator' or \
        name == 'method_descriptor' or \
        name == 'cython_function_or_method' or \
        name == 'builtin_function_or_method'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号