Chapter 8. Core Built-ins

第八章 核心内置对象

The term built-in has more than one meaning in Python. In most contexts, a built-in means an object directly accessible to Python code without an import statement. "Python built-ins" on page 141 shows the mechanism that Python uses to allow this direct access. Built-in types in Python include numbers, sequences, dictionaries, sets, functions (covered in Chapter 4), classes (covered in "Python Classes" on page 82), standard exception classes (covered in "Exception Objects" on page 129), and modules (covered in "Module Objects" on page 139). The built-in file object is covered in "File Objects" on page 216, and "Internal Types" on page 331 covers some built-in types intrinsic to Python's internal operation. This chapter provides additional coverage of the core built-in types (in "Built-in Types" on page 154) and covers built-in functions available in module _ _builtin_ _ (in "Built-in Functions" on page 158).

内置的(Built-in)这个词在Python中有多种含义。多数情况下,一个内置的对象指不用Import声明就可以在Python代码当中调用的对象。在141页的“Python内置对象(Built-ins)”中介绍了这种直接调用能力的机制。Python的内置类型包括数字(numbers),队列(sequences),字典(dictionaries),集合(sets),函数(functions )(在第四章有介绍),类(在82页的Python Classes有介绍),标准异常类(standard exception classes)(在129页的"Exception Objects" 中有介绍),和模块(modules)(在139页的"Module Objects"有介绍)。内置文件对象在216页的"File Objects"有介绍,

As I mentioned in "Python built-ins" on page 141, some modules are known as "built-in" because they are an integral part of the Python standard library (even though it takes an import statement to access them), as distinguished from separate, optional add-on modules, also called Python extensions. This chapter documents some core built-in modules, essentially those that offer functionality that, in some other languages, is built into the languages themselves: namely, modules sys in "The sys Module" on page 168, copy in "The copy Module" on page 172, collections in "The collections Module" on page 173, functional (2.5 only) in "The functional Module" on page 175, bisect in "The bisect Module" on page 176, heapq in "The heapq Module" on page 177, UserDict in "The UserDict Module" on page 178, optparse in "The optparse Module" on page 179, and itertools in "The itertools Module" on page 183. Chapter 9 covers some string-related core built-in modules (string in "The string Module" on page 191, codecs in "The codecs Module" on page 199, unicodedata in "The unicodedata Module" on page 200, and re in "Regular Expressions and the re Module" on page 201). Parts III and IV cover many other modules found in Python's standard library.

PythonInANutshell/Ch-8.1 (last edited 2009-12-25 07:16:38 by localhost)