2016-12-28 5 views

答えて

0

「真実」値として扱う必要があります。これは実際にCPythonの実装の詳細ですが、おそらく自分自身については心配するべきではありません。ただ、やる:あなたが疑問に思う場合

if inspect.isawaitable(coro): 

を、ここinspect.pyから言っ関数の実装です:

def isawaitable(object): 
"""Return true is object can be passed to an ``await`` expression.""" 
return (isinstance(object, types.CoroutineType) or 
     isinstance(object, types.GeneratorType) and 
      object.gi_code.co_flags & CO_ITERABLE_COROUTINE or 
     isinstance(object, collections.abc.Awaitable)) 

は、あなたの戻り値を担当する作品は、どの実際

object.gi_code.co_flags & CO_ITERABLE_COROUTINE 

です256(2^8)と評価されます。

関連する問題