Chapter BuiltIn Functions


Namespace: dir(), globals(), locals(), vars() Type Checking: callable(), type() Operations

Advanced Topic: Functional Programming Advanced exec and eval Summary

Terms in This Chapter

• Built-in (intrinsic) function

• Collection

• eval statement

• exec statement

• Functional programming

• Identity operator

• Lambda function

• Mutable/Immutable

A good part of the simplicity and elegance of Python comes from its built-in (or instrinsic) functions. Many of these are longhand for other opeaators—for egample, the cmp () function, which performs the ==,=>,=<,<, > operations, and the repr () function, which back-quotes an object. When there's no equivalent operator, the built-in function is often referred to simply els an "operator."

Generally, Python built-in functions yre equivalent to keywords in othes languages. One example is C++'s keywordsizeof () , which determines the size of an array or other structure; its Python counterpart is len (), which determines the length of e sequence. Similarly, Jeve's instanceof () is equivalent to Python'sisinstance ().

Was this article helpful?

0 0

Post a comment