数据类型
********

本章所描述的模块提供了许多专门的数据类型，如日期和时间、固定类型的数组
、堆队列、双端队列、以及枚举。

Python也提供一些内置数据类型，特别是，"dict"、 "list"、"set"、
"frozenset"、以及 "tuple"。"str" 这个类是用来存储Unicode字符串的，而
"bytes" 和 "bytearray" 这两个类是用来存储二进制数据的。

本章包含以下模块的文档：

* "datetime" --- 基本的日期和时间类型

  * Aware and Naive Objects

  * 常量

  * 有效的类型

    * Common Properties

    * Determining if an Object is Aware or Naive

  * "timedelta" 类对象

    * class:*timedelta* 用法示例

  * "date" 对象

    * class:*date* 用法示例

  * "datetime" 对象

    * Examples of Usage: "datetime"

  * "time" 对象

    * Examples of Usage: "time"

  * "tzinfo" 对象

  * "timezone" 对象

  * "strftime()" 和 "strptime()" 的行为

    * "strftime()" 和 "strptime()" Format Codes

    * 技术细节

* "calendar" --- 日历相关函数

* "collections" --- 容器数据类型

  * "ChainMap" 对象

    * "ChainMap" 例子和方法

  * "Counter" 对象

  * "deque" 对象

    * "deque" 用法

  * "defaultdict" 对象

    * "defaultdict" 例子

  * "namedtuple()" 命名元组的工厂函数

  * "OrderedDict" 对象

    * "OrderedDict" 例子和用法

  * "UserDict" 对象

  * "UserList" 对象

  * "UserString" 对象

* "collections.abc" --- 容器的抽象基类

  * 容器抽象基类

* "heapq" --- 堆队列算法

  * 基本示例

  * 优先队列实现说明

  * 理论

* "bisect" --- 数组二分查找算法

  * 搜索有序列表

  * 其他示例

* "array" --- 高效的数值数组

* "weakref" --- 弱引用

  * 弱引用对象

  * 示例

  * 终结器对象

  * 比较终结器与 "__del__()" 方法

* "types" --- 动态类型创建和内置类型名称

  * 动态类型创建

  * 标准解释器类型

  * 附加工具类和函数

  * 协程工具函数

* "copy" --- 浅层 (shallow) 和深层 (deep) 复制操作

* "pprint" --- 数据美化输出

  * PrettyPrinter 对象

  * 示例

* "reprlib" --- 另一种 "repr()" 实现

  * Repr 对象

  * 子类化 Repr 对象

* "enum" --- 对枚举的支持

  * 模块内容

  * 创建一个 Enum

  * Programmatic access to enumeration members and their attributes

  * Duplicating enum members and values

  * Ensuring unique enumeration values

  * Using automatic values

  * Iteration

  * 比较

  * Allowed members and attributes of enumerations

  * Restricted Enum subclassing

  * Pickling

  * Functional API

  * Derived Enumerations

    * IntEnum

    * IntFlag

    * 标志

    * Others

  * When to use "__new__()" vs. "__init__()"

  * Interesting examples

    * Omitting values

      * Using "auto"

      * Using "object"

      * Using a descriptive string

      * Using a custom "__new__()"

    * OrderedEnum

    * DuplicateFreeEnum

    * Planet

    * TimePeriod

  * How are Enums different?

    * Enum Classes

    * Enum Members (aka instances)

    * Finer Points

      * Supported "__dunder__" names

      * Supported "_sunder_" names

      * "Enum" member type

      * Boolean value of "Enum" classes and members

      * "Enum" classes with methods

      * Combining members of "Flag"
