> **Источник:** https://python-all.ru/2.7/library/datatypes.html
>
> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.

---

# 8. Типы данных

Модули, описанные в этой главе, предоставляют разнообразные специализированные типы данных, такие как даты и время, массивы фиксированного типа, кучи (heap queues), синхронизированные очереди и множества.

Python также предоставляет некоторые встроенные типы данных, в частности, [`dict`](https://python-all.ru/2.7/library/stdtypes.html#dict), `list`, [`set`](https://python-all.ru/2.7/library/stdtypes.html#set) (которые вместе с [`frozenset`](https://python-all.ru/2.7/library/stdtypes.html#frozenset) заменяют устаревший модуль [`sets`](https://python-all.ru/2.7/library/sets.html#module-sets)) и [`tuple`](https://python-all.ru/2.7/library/functions.html#tuple). Класс [`str`](https://python-all.ru/2.7/library/functions.html#str) можно использовать для работы с двоичными данными и 8-битным текстом, а класс [`unicode`](https://python-all.ru/2.7/library/functions.html#unicode) – для работы с текстом Unicode.

В этой главе описаны следующие модули:

- [8.1. `datetime` – Базовые типы даты и времени](https://python-all.ru/2.7/library/datetime.html)

  - [8.1.1. Доступные типы](https://python-all.ru/2.7/library/datetime.html#available-types)
  - [8.1.2. `timedelta` Объекты](https://python-all.ru/2.7/library/datetime.html#timedelta-objects)
  - [8.1.3. `date` Объекты](https://python-all.ru/2.7/library/datetime.html#date-objects)
  - [8.1.4. `datetime` Объекты](https://python-all.ru/2.7/library/datetime.html#datetime-objects)
  - [8.1.5. `time` Объекты](https://python-all.ru/2.7/library/datetime.html#time-objects)
  - [8.1.6. `tzinfo` Объекты](https://python-all.ru/2.7/library/datetime.html#tzinfo-objects)
  - [8.1.7. `strftime()` и `strptime()` Поведение](https://python-all.ru/2.7/library/datetime.html#strftime-and-strptime-behavior)
- [8.2. `calendar` – Общие функции, связанные с календарём](https://python-all.ru/2.7/library/calendar.html)
- [8.3. `collections` – Высокопроизводительные типы данных контейнеров](https://python-all.ru/2.7/library/collections.html)

  - [8.3.1. `Counter` объекты](https://python-all.ru/2.7/library/collections.html#counter-objects)
  - [8.3.2. `deque` объекты](https://python-all.ru/2.7/library/collections.html#deque-objects)

    - [8.3.2.1. `deque` Рецепты](https://python-all.ru/2.7/library/collections.html#deque-recipes)
  - [8.3.3. `defaultdict` объекты](https://python-all.ru/2.7/library/collections.html#defaultdict-objects)

    - [8.3.3.1. `defaultdict` Примеры](https://python-all.ru/2.7/library/collections.html#defaultdict-examples)
  - [8.3.4. `namedtuple()` Фабричная функция для кортежей с именованными полями](https://python-all.ru/2.7/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields)
  - [8.3.5. `OrderedDict` объекты](https://python-all.ru/2.7/library/collections.html#ordereddict-objects)

    - [8.3.5.1. `OrderedDict` Примеры и рецепты](https://python-all.ru/2.7/library/collections.html#ordereddict-examples-and-recipes)
  - [8.3.6. Абстрактные базовые классы коллекций](https://python-all.ru/2.7/library/collections.html#collections-abstract-base-classes)
- [8.4. `heapq` – Алгоритм очереди на куче](https://python-all.ru/2.7/library/heapq.html)

  - [8.4.1. Основные примеры](https://python-all.ru/2.7/library/heapq.html#basic-examples)
  - [8.4.2. Замечания по реализации очереди с приоритетом](https://python-all.ru/2.7/library/heapq.html#priority-queue-implementation-notes)
  - [8.4.3. Теория](https://python-all.ru/2.7/library/heapq.html#theory)
- [8.5. `bisect` – Алгоритм бинарного поиска](https://python-all.ru/2.7/library/bisect.html)

  - [8.5.1. Поиск в отсортированных списках](https://python-all.ru/2.7/library/bisect.html#searching-sorted-lists)
  - [8.5.2. Другие примеры](https://python-all.ru/2.7/library/bisect.html#other-examples)
- [8.6. `array` – Эффективные массивы числовых значений](https://python-all.ru/2.7/library/array.html)
- [8.7. `sets` – Неупорядоченные коллекции уникальных элементов](https://python-all.ru/2.7/library/sets.html)

  - [8.7.1. Объекты множеств](https://python-all.ru/2.7/library/sets.html#set-objects)
  - [8.7.2. Пример](https://python-all.ru/2.7/library/sets.html#example)
  - [8.7.3. Протокол автоматического преобразования в неизменяемое](https://python-all.ru/2.7/library/sets.html#protocol-for-automatic-conversion-to-immutable)
  - [8.7.4. Сравнение со встроенными типами `set`](https://python-all.ru/2.7/library/sets.html#comparison-to-the-built-in-set-types)
- [8.8. `sched` – Планировщик событий](https://python-all.ru/2.7/library/sched.html)

  - [8.8.1. Объекты планировщика](https://python-all.ru/2.7/library/sched.html#scheduler-objects)
- [8.9. `mutex` – Поддержка взаимного исключения](https://python-all.ru/2.7/library/mutex.html)

  - [8.9.1. Объекты мьютекса](https://python-all.ru/2.7/library/mutex.html#mutex-objects)
- [8.10. `Queue` – Класс синхронизированной очереди](https://python-all.ru/2.7/library/queue.html)

  - [8.10.1. Объекты очереди](https://python-all.ru/2.7/library/queue.html#queue-objects)
- [8.11. `weakref` – Слабые ссылки](https://python-all.ru/2.7/library/weakref.html)

  - [8.11.1. Объекты слабых ссылок](https://python-all.ru/2.7/library/weakref.html#weak-reference-objects)
  - [8.11.2. Пример](https://python-all.ru/2.7/library/weakref.html#example)
- [8.12. `UserDict` – Класс-обёртка для объектов словаря](https://python-all.ru/2.7/library/userdict.html)
- [8.13. `UserList` – Класс-обёртка для объектов списка](https://python-all.ru/2.7/library/userdict.html#module-UserList)
- [8.14. `UserString` – Класс-обёртка для строковых объектов](https://python-all.ru/2.7/library/userdict.html#module-UserString)
- [8.15. `types` – Имена встроенных типов](https://python-all.ru/2.7/library/types.html)
- [8.16. `new` – Создание внутренних объектов времени выполнения](https://python-all.ru/2.7/library/new.html)
- [8.17. `copy` – Операции поверхностного и глубокого копирования](https://python-all.ru/2.7/library/copy.html)
- [8.18. `pprint` – Форматированный вывод данных](https://python-all.ru/2.7/library/pprint.html)

  - [8.18.1. Объекты PrettyPrinter](https://python-all.ru/2.7/library/pprint.html#prettyprinter-objects)
  - [8.18.2. Пример pprint](https://python-all.ru/2.7/library/pprint.html#pprint-example)
- [8.19. `repr` – альтернативная реализация `repr()`](https://python-all.ru/2.7/library/repr.html)

  - [8.19.1. Объекты Repr](https://python-all.ru/2.7/library/repr.html#repr-objects)
  - [8.19.2. Создание подклассов объектов Repr](https://python-all.ru/2.7/library/repr.html#subclassing-repr-objects)
