Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

14.1. Callable Objects

A number of Python objects are what we describe as “callable,” meaning any object which can be invoked with the function operator “()”. The function operator is placed immediately following the name of the callable to invoke it. For example, the function “foo” is called with “foo()”. You already know this. Callables may also be invoked via functional programming interfaces such as apply(), filter(), map(), and reduce(), all of which we discussed in Chapter 11. Python has four callable objects: functions, methods, classes, and some class instances. Keep in mind that any additional references or aliases of these objects are callable, too.

14.1.1. Functions

The first callable object we introduced was the function. There are three types of different function objects, the first being the Python built-in functions.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial