2020-12-16から1日間の記事一覧
オブジェクトが関数かどうかの判定方法は2通り。・isinstance() で判定する場合は、types の FunctionType で判定 import types f = lambda x:x+1 print( isinstance(f, types.FunctionType) ) # True ・callable() で判定、(呼び出せるかという文字通りの…
オブジェクトが関数かどうかの判定方法は2通り。・isinstance() で判定する場合は、types の FunctionType で判定 import types f = lambda x:x+1 print( isinstance(f, types.FunctionType) ) # True ・callable() で判定、(呼び出せるかという文字通りの…