w3resource
w3resource logo

Python: callable() function

(追記) (追記ここまで)
(追記) (追記ここまで)

callable() function

The callable() function returns True if the object argument appears callable, False if not.

Syntax:

callable(object)

Python: Built-in function - callable function()

Version:

(Python 3.2)

Parameter:

Name Description
object A callable is anything that can be called.

Return value:

boolean

Example: Python callable() function

a = 10
print(callable(a))
def testFunction():
 print("Test")
b = testFunction
print(callable(b))

Output:

False
True

Example: Callable Object

class Foo:
 def __call__(self):
 print('Print Python callable objects')
print(callable(Foo))

Output:

True

Python Code Editor:

[フレーム]

PREV : bytes()
NEXT : chr()

Test your Python skills with w3resource's quiz



Follow us on Facebook and Twitter for latest update.

(追記) (追記ここまで)


(追記) (追記ここまで)
(追記) (追記ここまで)


AltStyle によって変換されたページ (->オリジナル) /