Skip to content

Commit b008f78

Browse files
committed
inspect: implement iscoroutine(function)
Alias to isgenerator*.
1 parent bae60bf commit b008f78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python-stdlib/inspect/inspect.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ def getmembers(obj, pred=None):
1414
def isfunction(obj):
1515
return isinstance(obj, type(isfunction))
1616

17-
1817
def isgeneratorfunction(obj):
1918
return isinstance(obj, type(lambda: (yield)))
2019

20+
iscoroutinefunction = isgeneratorfunction
2121

2222
def isgenerator(obj):
2323
return isinstance(obj, type(lambda: (yield)()))
2424

25+
iscoroutine = isgenerator
26+
2527

2628
class _Class:
2729
def meth():

0 commit comments

Comments
 (0)