标签:分享 com 经典 的区别 alt bubuko 区别 func elf
from types import MethodType,FunctionType class A: def func(self):pass a = A().func b = A.func print(isinstance(a,FunctionType)) print(isinstance(b,FunctionType)) print(isinstance(a,MethodType)) print(isinstance(b,MethodType))
2、生成器相关
def test(): for i in range(4): yield i def add(n,i): return n+i g=test() for n in [1,10]: g=(add(n,i) for i in g) print(list(g))
def test(): for i in range(4): yield i def add(n,i): return n+i g=test() for n in [1,10]: h=(add(n,i) for i in g) print(list(h))
标签:分享 com 经典 的区别 alt bubuko 区别 func elf
原文地址:https://www.cnblogs.com/linshuhui/p/9552656.html