Data Types
**********

The modules described in this chapter provide a variety of specialized
data types such as dates and times, fixed-type arrays, heap queues,
double-ended queues, and enumerations.

Python also provides some built-in data types, in particular, "dict",
"list", "set" and "frozenset", and "tuple".  The "str" class is used
to hold Unicode strings, and the "bytes" and "bytearray" classes are
used to hold binary data.

The following modules are documented in this chapter:

* "datetime" — Basic date and time types

  * Aware and Naive Objects

  * Constants

    * "MINYEAR"

    * "MAXYEAR"

    * "UTC"

  * Available Types

    * Common Properties

    * Determining if an Object is Aware or Naive

  * "timedelta" Objects

    * "timedelta"

    * "min"

    * "max"

    * "resolution"

    * "days"

    * "seconds"

    * "microseconds"

    * "total_seconds()"

    * Examples of usage: "timedelta"

  * "date" Objects

    * "date"

    * "today()"

    * "fromtimestamp()"

    * "fromordinal()"

    * "fromisoformat()"

    * "fromisocalendar()"

    * "min"

    * "max"

    * "resolution"

    * "year"

    * "month"

    * "day"

    * "replace()"

    * "timetuple()"

    * "toordinal()"

    * "weekday()"

    * "isoweekday()"

    * "isocalendar()"

    * "isoformat()"

    * "__str__()"

    * "ctime()"

    * "strftime()"

    * "__format__()"

    * Examples of Usage: "date"

  * "datetime" Objects

    * "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__()"

    * Examples of Usage: "datetime"

  * "time" Objects

    * "time"

    * "min"

    * "max"

    * "resolution"

    * "hour"

    * "minute"

    * "second"

    * "microsecond"

    * "tzinfo"

    * "fold"

    * "fromisoformat()"

    * "replace()"

    * "isoformat()"

    * "__str__()"

    * "strftime()"

    * "__format__()"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * Examples of Usage: "time"

  * "tzinfo" Objects

    * "tzinfo"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * "fromutc()"

  * "timezone" Objects

    * "timezone"

    * "utcoffset()"

    * "tzname()"

    * "dst()"

    * "fromutc()"

    * "utc"

  * "strftime()" and "strptime()" Behavior

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

    * Technical Detail

* "zoneinfo" — IANA time zone support

  * 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

  * Functions

    * "available_timezones()"

    * "reset_tzpath()"

  * Globals

    * "TZPATH"

  * Exceptions and warnings

    * "ZoneInfoNotFoundError"

    * "InvalidTZPathWarning"

* "calendar" — General calendar-related functions

  * "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"

  * Command-Line Usage

* "collections" — Container datatypes

  * "ChainMap" objects

    * "ChainMap"

      * "maps"

      * "new_child()"

      * "parents"

    * "ChainMap" Examples and Recipes

  * "Counter" objects

    * "Counter"

      * "elements()"

      * "most_common()"

      * "subtract()"

      * "total()"

      * "fromkeys()"

      * "update()"

  * "deque" objects

    * "deque"

      * "append()"

      * "appendleft()"

      * "clear()"

      * "copy()"

      * "count()"

      * "extend()"

      * "extendleft()"

      * "index()"

      * "insert()"

      * "pop()"

      * "popleft()"

      * "remove()"

      * "reverse()"

      * "rotate()"

      * "maxlen"

    * "deque" Recipes

  * "defaultdict" objects

    * "defaultdict"

      * "__missing__()"

      * "default_factory"

    * "defaultdict" Examples

  * "namedtuple()" Factory Function for Tuples with Named Fields

    * "namedtuple()"

    * "_make()"

    * "_asdict()"

    * "_replace()"

    * "_fields"

    * "_field_defaults"

  * "OrderedDict" objects

    * "OrderedDict"

      * "popitem()"

      * "move_to_end()"

    * "OrderedDict" Examples and Recipes

  * "UserDict" objects

    * "UserDict"

      * "data"

  * "UserList" objects

    * "UserList"

      * "data"

  * "UserString" objects

    * "UserString"

      * "data"

* "collections.abc" — Abstract Base Classes for Containers

  * Collections Abstract Base Classes

  * Collections Abstract Base Classes – Detailed Descriptions

    * "Container"

    * "Hashable"

    * "Sized"

    * "Callable"

    * "Iterable"

    * "Collection"

    * "Iterator"

    * "Reversible"

    * "Generator"

    * "Sequence"

    * "MutableSequence"

    * "ByteString"

    * "Set"

    * "MutableSet"

    * "Mapping"

    * "MutableMapping"

    * "MappingView"

    * "ItemsView"

    * "KeysView"

    * "ValuesView"

    * "Awaitable"

    * "Coroutine"

    * "AsyncIterable"

    * "AsyncIterator"

    * "AsyncGenerator"

    * "Buffer"

  * Examples and Recipes

* "heapq" — Heap queue algorithm

  * "heappush()"

  * "heappop()"

  * "heappushpop()"

  * "heapify()"

  * "heapreplace()"

  * "merge()"

  * "nlargest()"

  * "nsmallest()"

  * Basic Examples

  * Priority Queue Implementation Notes

  * Theory

* "bisect" — Array bisection algorithm

  * "bisect_left()"

  * "bisect_right()"

  * "bisect()"

  * "insort_left()"

  * "insort_right()"

  * "insort()"

  * Performance Notes

  * Searching Sorted Lists

  * Examples

* "array" — Efficient arrays of numeric values

  * "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" — Weak references

  * "ref"

    * "__callback__"

  * "proxy()"

  * "getweakrefcount()"

  * "getweakrefs()"

  * "WeakKeyDictionary"

  * "keyrefs()"

  * "WeakValueDictionary"

  * "valuerefs()"

  * "WeakSet"

  * "WeakMethod"

  * "finalize"

    * "__call__()"

    * "detach()"

    * "peek()"

    * "alive"

    * "atexit"

  * "ReferenceType"

  * "ProxyType"

  * "CallableProxyType"

  * "ProxyTypes"

  * Weak Reference Objects

  * Example

  * Finalizer Objects

  * Comparing finalizers with "__del__()" methods

* "types" — Dynamic type creation and names for built-in 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 and deep copy operations

  * "copy()"

  * "deepcopy()"

  * "replace()"

  * "Error"

  * "__copy__()"

  * "__deepcopy__()"

  * "__replace__()"

* "pprint" — Data pretty printer

  * Functions

    * "pp()"

    * "pprint()"

    * "pformat()"

    * "isreadable()"

    * "isrecursive()"

    * "saferepr()"

  * PrettyPrinter Objects

    * "PrettyPrinter"

    * "pformat()"

    * "pprint()"

    * "isreadable()"

    * "isrecursive()"

    * "format()"

  * Example

* "reprlib" — Alternate "repr()" implementation

  * "Repr"

  * "aRepr"

  * "repr()"

  * "recursive_repr()"

  * Repr Objects

    * "fillvalue"

    * "maxlevel"

    * "maxdict"

    * "maxlist"

    * "maxtuple"

    * "maxset"

    * "maxfrozenset"

    * "maxdeque"

    * "maxarray"

    * "maxlong"

    * "maxstring"

    * "maxother"

    * "indent"

    * "repr()"

    * "repr1()"

  * Subclassing Repr Objects

* "enum" — Support for enumerations

  * Module Contents

  * Data Types

    * "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"

    * Supported "__dunder__" names

    * Supported "_sunder_" names

  * Utilities and Decorators

    * "auto"

    * "property()"

    * "unique()"

    * "verify()"

    * "member()"

    * "nonmember()"

    * "global_enum()"

    * "show_flag_values()"

  * Notes

* "graphlib" — Functionality to operate with graph-like structures

  * "TopologicalSorter"

    * "add()"

    * "prepare()"

    * "is_active()"

    * "done()"

    * "get_ready()"

    * "static_order()"

  * Exceptions

    * "CycleError"
