Warum wird eine Funktion nicht als asynchron vom Typ types.CoroutineType deklariert?
Zitat ausHie:
types.CoroutineType
Die Art der Coroutine-Objekte, die von asynchronen Def-Funktionen erstellt wurden.
Zitat ausHie:
Funktionen, die mit der Syntax async def definiert wurden, sind immer Coroutine-Funktionen, auch wenn sie keine Schlüsselwörter await oder async enthalten.
Python-Konsolensitzung:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import types
>>> def f(): pass
...
>>> async def g(): pass
...
>>> isinstance(f, types.FunctionType)
True
>>> isinstance(g, types.FunctionType)
True
>>> isinstance(g, types.CoroutineType)
False
>>>
Warum nichtisinstance(g, types.CoroutineType)
auswerten zuTrue
?