資料型別
********

本章節所描述的模組 (module) 提供了多樣的專門資料型別，例如日期與時間、
固定型別陣列 (fixed-type arrays)、堆積佇列 (heap queues)、雙端佇列
(double-ended queues) 與列舉 (enumerations)。

Python 也有提供一些內建資料型別，特別是 "dict"、"list"、"set" 與
"frozenset" 和 "tuple"。"str" 類別是用來儲存 Unicode 字串，"bytes" 與
"bytearray" 類別則是用來儲存二進位制資料。

本章節包含下列模組的文件：

* "datetime" --- 日期與時間的基本型別

  * Aware and Naive Objects

  * 常數

    * "MINYEAR"

    * "MAXYEAR"

    * "UTC"

  * Available Types

    * 常見屬性

    * Determining if an Object is Aware or Naive

  * "timedelta" 物件

    * "timedelta"

    * "min"

    * "max"

    * "resolution"

    * "days"

    * "seconds"

    * "microseconds"

    * "total_seconds()"

    * 用法範例："timedelta"

  * "date" 物件

    * "date"

    * "today()"

    * "fromtimestamp()"

    * "fromordinal()"

    * "fromisoformat()"

    * "fromisocalendar()"

    * "strptime()"

    * "min"

    * "max"

    * "resolution"

    * "year"

    * "month"

    * "day"

    * "replace()"

    * "timetuple()"

    * "toordinal()"

    * "weekday()"

    * "isoweekday()"

    * "isocalendar()"

    * "isoformat()"

    * "__str__()"

    * "ctime()"

    * "strftime()"

    * "__format__()"

    * 用法範例："date"

  * "datetime" 物件

    * "datetime"

    * "today()"

    * "now()"

    * "utcnow()"

    * "fromtimestamp()"

    * "utcfromtimestamp()"

    * "fromordinal()"

    * "combine()"

    * "fromisoformat()"

    * "fromisocalendar()"

    * "strptime()"

    * "min"

    * "max"

    * "resolution"

    * "year"

    * "month"

    * "day"

    * "hour"

    * "minute"

    * "second"

    * "microsecond"

    * "tzinfo"

    * "fold"

    * "date()"

    * "time()"

    * "timetz()"

    * "replace()"

    * "astimezone()"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * "timetuple()"

    * "utctimetuple()"

    * "toordinal()"

    * "timestamp()"

    * "weekday()"

    * "isoweekday()"

    * "isocalendar()"

    * "isoformat()"

    * "__str__()"

    * "ctime()"

    * "strftime()"

    * "__format__()"

    * 用法範例："datetime"

  * "time" 物件

    * "time"

    * "min"

    * "max"

    * "resolution"

    * "hour"

    * "minute"

    * "second"

    * "microsecond"

    * "tzinfo"

    * "fold"

    * "fromisoformat()"

    * "strptime()"

    * "replace()"

    * "isoformat()"

    * "__str__()"

    * "strftime()"

    * "__format__()"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * 用法範例："time"

  * "tzinfo" 物件

    * "tzinfo"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * "fromutc()"

  * "timezone" 物件

    * "timezone"

    * "utcoffset()"

    * "tzname()"

    * "dst()"

    * "fromutc()"

    * "utc"

  * "strftime()" 與 "strptime()" 的行為

    * "strftime()" 與 "strptime()" 格式碼

    * 技術細節

* "zoneinfo" --- IANA 時區支援

  * Using "ZoneInfo"

  * Data sources

    * Configuring the data sources

      * Compile-time configuration

      * Environment configuration

      * Runtime configuration

  * The "ZoneInfo" class

    * "ZoneInfo"

    * "from_file()"

    * "no_cache()"

    * "clear_cache()"

    * "key"

    * String representations

    * Pickle serialization

  * 函式

    * "available_timezones()"

    * "reset_tzpath()"

  * Globals

    * "TZPATH"

  * Exceptions and warnings

    * "ZoneInfoNotFoundError"

    * "InvalidTZPathWarning"

* "calendar" --- 日曆相關函式

  * "Calendar"

    * "iterweekdays()"

    * "itermonthdates()"

    * "itermonthdays()"

    * "itermonthdays2()"

    * "itermonthdays3()"

    * "itermonthdays4()"

    * "monthdatescalendar()"

    * "monthdays2calendar()"

    * "monthdayscalendar()"

    * "yeardatescalendar()"

    * "yeardays2calendar()"

    * "yeardayscalendar()"

  * "TextCalendar"

    * "formatmonth()"

    * "prmonth()"

    * "formatyear()"

    * "pryear()"

  * "HTMLCalendar"

    * "formatmonth()"

    * "formatyear()"

    * "formatyearpage()"

    * "formatmonthname()"

    * "cssclasses"

    * "cssclass_noday"

    * "cssclasses_weekday_head"

    * "cssclass_month_head"

    * "cssclass_month"

    * "cssclass_year"

    * "cssclass_year_head"

  * "LocaleTextCalendar"

  * "LocaleHTMLCalendar"

  * "setfirstweekday()"

  * "firstweekday()"

  * "isleap()"

  * "leapdays()"

  * "weekday()"

  * "weekheader()"

  * "monthrange()"

  * "monthcalendar()"

  * "prmonth()"

  * "month()"

  * "prcal()"

  * "calendar()"

  * "timegm()"

  * "day_name"

  * "day_abbr"

  * "MONDAY"

  * "TUESDAY"

  * "WEDNESDAY"

  * "THURSDAY"

  * "FRIDAY"

  * "SATURDAY"

  * "SUNDAY"

  * "Day"

  * "month_name"

  * "month_abbr"

  * "JANUARY"

  * "FEBRUARY"

  * "MARCH"

  * "APRIL"

  * "MAY"

  * "JUNE"

  * "JULY"

  * "AUGUST"

  * "SEPTEMBER"

  * "OCTOBER"

  * "NOVEMBER"

  * "DECEMBER"

  * "Month"

  * "IllegalMonthError"

    * "month"

  * "IllegalWeekdayError"

    * "weekday"

  * 命令列用法

* "collections" --- 容器資料型態

  * "ChainMap" 物件

    * "ChainMap"

      * "maps"

      * "new_child()"

      * "parents"

    * "ChainMap" 範例和用法

  * "Counter" 物件

    * "Counter"

      * "elements()"

      * "most_common()"

      * "subtract()"

      * "total()"

      * "fromkeys()"

      * "update()"

  * "deque" 物件

    * "deque"

      * "append()"

      * "appendleft()"

      * "clear()"

      * "copy()"

      * "count()"

      * "extend()"

      * "extendleft()"

      * "index()"

      * "insert()"

      * "pop()"

      * "popleft()"

      * "remove()"

      * "reverse()"

      * "rotate()"

      * "maxlen"

    * "deque" 用法

  * "defaultdict" 物件

    * "defaultdict"

      * "__missing__()"

      * "default_factory"

    * "defaultdict" 範例

  * "namedtuple()" 擁有具名欄位之 tuple 的工廠函式

    * "namedtuple()"

    * "_make()"

    * "_asdict()"

    * "_replace()"

    * "_fields"

    * "_field_defaults"

  * "OrderedDict" 物件

    * "OrderedDict"

      * "popitem()"

      * "move_to_end()"

    * "OrderedDict" 範例與用法

  * "UserDict" 物件

    * "UserDict"

      * "data"

  * "UserList" 物件

    * "UserList"

      * "data"

  * "UserString" 物件

    * "UserString"

      * "data"

* "collections.abc" --- 容器的抽象基底類別

  * Collections Abstract Base Classes

  * Collections Abstract Base Classes -- Detailed Descriptions

    * "Container"

    * "Hashable"

    * "Sized"

    * "Callable"

    * "Iterable"

    * "Collection"

    * "Iterator"

    * "Reversible"

    * "Generator"

    * "Sequence"

    * "MutableSequence"

    * "Set"

    * "MutableSet"

    * "Mapping"

    * "MutableMapping"

    * "MappingView"

    * "ItemsView"

    * "KeysView"

    * "ValuesView"

    * "Awaitable"

    * "Coroutine"

    * "AsyncIterable"

    * "AsyncIterator"

    * "AsyncGenerator"

    * "Buffer"

  * Examples and Recipes

* "heapq" --- 堆積佇列 (heap queue) 演算法

  * "heappush()"

  * "heappop()"

  * "heappushpop()"

  * "heapify()"

  * "heapreplace()"

  * "merge()"

  * "nlargest()"

  * "nsmallest()"

  * 基礎範例

  * 優先佇列實作細節

  * 原理

* "bisect" --- 陣列二分演算法 (Array bisection algorithm)

  * "bisect_left()"

  * "bisect_right()"

  * "bisect()"

  * "insort_left()"

  * "insort_right()"

  * "insort()"

  * 效能考量

  * 搜尋一個已排序的 list

  * 範例

* "array" --- 高效率的數值型陣列

  * "typecodes"

  * "array"

    * "typecode"

    * "itemsize"

    * "append()"

    * "buffer_info()"

    * "byteswap()"

    * "count()"

    * "extend()"

    * "frombytes()"

    * "fromfile()"

    * "fromlist()"

    * "fromunicode()"

    * "index()"

    * "insert()"

    * "pop()"

    * "remove()"

    * "clear()"

    * "reverse()"

    * "tobytes()"

    * "tofile()"

    * "tolist()"

    * "tounicode()"

* "weakref" --- 弱參照

  * "ref"

    * "__callback__"

  * "proxy()"

  * "getweakrefcount()"

  * "getweakrefs()"

  * "WeakKeyDictionary"

  * "keyrefs()"

  * "WeakValueDictionary"

  * "valuerefs()"

  * "WeakSet"

  * "WeakMethod"

  * "finalize"

    * "__call__()"

    * "detach()"

    * "peek()"

    * "alive"

    * "atexit"

  * "ReferenceType"

  * "ProxyType"

  * "CallableProxyType"

  * "ProxyTypes"

  * 弱參照物件

  * 範例

  * 最終化器物件

  * 最終化器與 "__del__()" 方法的比較

* "types" --- 動態型別建立與內建型別名稱

  * Dynamic Type Creation

    * "new_class()"

    * "prepare_class()"

    * "resolve_bases()"

    * "get_original_bases()"

  * Standard Interpreter Types

    * "NoneType"

    * "FunctionType"

    * "LambdaType"

    * "GeneratorType"

    * "CoroutineType"

    * "AsyncGeneratorType"

    * "CodeType"

    * "CellType"

    * "MethodType"

    * "BuiltinFunctionType"

    * "BuiltinMethodType"

    * "WrapperDescriptorType"

    * "MethodWrapperType"

    * "NotImplementedType"

    * "MethodDescriptorType"

    * "ClassMethodDescriptorType"

    * "ModuleType"

    * "EllipsisType"

    * "GenericAlias"

    * "UnionType"

    * "TracebackType"

    * "FrameType"

    * "GetSetDescriptorType"

    * "MemberDescriptorType"

    * "MappingProxyType"

      * "copy()"

      * "get()"

      * "items()"

      * "keys()"

      * "values()"

    * "CapsuleType"

  * Additional Utility Classes and Functions

    * "SimpleNamespace"

    * "DynamicClassAttribute()"

  * Coroutine Utility Functions

    * "coroutine()"

* "copy" --- 淺層 (shallow) 和深層 (deep) 複製操作

  * "copy()"

  * "deepcopy()"

  * "replace()"

  * "Error"

  * "__copy__()"

  * "__deepcopy__()"

  * "__replace__()"

* "pprint" --- 資料美化列印器

  * 函式

    * "pp()"

    * "pprint()"

    * "pformat()"

    * "isreadable()"

    * "isrecursive()"

    * "saferepr()"

  * PrettyPrinter 物件

    * "PrettyPrinter"

    * "pformat()"

    * "pprint()"

    * "isreadable()"

    * "isrecursive()"

    * "format()"

  * 範例

* "reprlib" --- "repr()" 的替代實作

  * "Repr"

  * "aRepr"

  * "repr()"

  * "recursive_repr()"

  * Repr 物件

    * "fillvalue"

    * "maxlevel"

    * "maxdict"

    * "maxlist"

    * "maxtuple"

    * "maxset"

    * "maxfrozenset"

    * "maxdeque"

    * "maxarray"

    * "maxlong"

    * "maxstring"

    * "maxother"

    * "indent"

    * "repr()"

    * "repr1()"

  * Subclassing Repr Objects

* "enum" --- 對列舉的支援

  * 模組內容

  * 資料型別

    * "EnumType"

      * "__call__()"

      * "__contains__()"

      * "__dir__()"

      * "__getitem__()"

      * "__iter__()"

      * "__len__()"

      * "__members__"

      * "__reversed__()"

      * "_add_alias_()"

      * "_add_value_alias_()"

    * "Enum"

      * "name"

      * "value"

      * "_name_"

      * "_value_"

      * "_order_"

      * "_ignore_"

      * "__dir__()"

      * "_generate_next_value_()"

      * "__init__()"

      * "__init_subclass__()"

      * "_missing_()"

      * "__new__()"

      * "__repr__()"

      * "__str__()"

      * "__format__()"

    * "IntEnum"

    * "StrEnum"

    * "Flag"

      * "__contains__()"

      * "__or__()"

      * "__and__()"

      * "__xor__()"

      * "_numeric_repr_()"

    * "IntFlag"

    * "ReprEnum"

    * "EnumCheck"

      * "UNIQUE"

      * "CONTINUOUS"

      * "NAMED_FLAGS"

    * "FlagBoundary"

      * "STRICT"

      * "CONFORM"

      * "EJECT"

      * "KEEP"

    * 支援 "__dunder__" 名稱

    * 支援 "_sunder_" 名稱

  * 通用項目與裝飾器

    * "auto"

    * "property()"

    * "unique()"

    * "verify()"

    * "member()"

    * "nonmember()"

    * "global_enum()"

    * "show_flag_values()"

  * 備註

* "graphlib" —-- 使用類圖 (graph-like) 結構進行操作的功能

  * "TopologicalSorter"

    * "add()"

    * "prepare()"

    * "is_active()"

    * "done()"

    * "get_ready()"

    * "static_order()"

  * 例外

    * "CycleError"
