Документация Python неофициальный перевод

concrete.md

168 строк · 13.2 КБ · обычная страница · сырой текст · скачать

1> **Источник:** https://python-all.ru/3.16/c-api/concrete.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Слой конкретных объектов89Функции из этой главы относятся к определённым типам объектов Python. Передача им объекта неправильного типа не рекомендуется; если объект получен из программы на Python и нет уверенности, что он имеет правильный тип, необходимо сначала выполнить проверку типа; например, чтобы проверить, является ли объект словарём, используйте [`PyDict_Check()`](https://python-all.ru/3.16/c-api/dict.html#c.PyDict_Check). Глава построена по принципу «родословного дерева» типов объектов Python.1011> **Предупреждение**12>13> Хотя функции, описанные в этой главе, тщательно проверяют тип передаваемых объектов, многие из них не проверяют, не передан ли `NULL` вместо допустимого объекта. Допуск `NULL` может привести к нарушениям доступа к памяти и немедленному завершению интерпретатора.1415## Фундаментальные объекты1617В этом разделе описаны объекты типов Python и синглтон `None`.1819- [Объекты типов](https://python-all.ru/3.16/c-api/type.html)2021  - [Создание типов, размещаемых в куче](https://python-all.ru/3.16/c-api/type.html#creating-heap-allocated-types)2223    - [Идентификаторы слотов типов](https://python-all.ru/3.16/c-api/type.html#type-slot-ids)24  - [Частично устаревший API](https://python-all.ru/3.16/c-api/type.html#soft-deprecated-api)25- [Объект `None`](https://python-all.ru/3.16/c-api/none.html)2627## Числовые объекты2829- [Объекты целых чисел](https://python-all.ru/3.16/c-api/long.html)3031  - [Экспортный API](https://python-all.ru/3.16/c-api/long.html#export-api)32  - [PyLongWriter API](https://python-all.ru/3.16/c-api/long.html#pylongwriter-api)33  - [Устаревший API](https://python-all.ru/3.16/c-api/long.html#deprecated-api)34- [Объекты логических значений](https://python-all.ru/3.16/c-api/bool.html)35- [Объекты чисел с плавающей запятой](https://python-all.ru/3.16/c-api/float.html)3637  - [Функции упаковки и распаковки](https://python-all.ru/3.16/c-api/float.html#pack-and-unpack-functions)3839    - [Функции упаковки](https://python-all.ru/3.16/c-api/float.html#pack-functions)40    - [Функции распаковки](https://python-all.ru/3.16/c-api/float.html#unpack-functions)41- [Объекты комплексных чисел](https://python-all.ru/3.16/c-api/complex.html)4243  - [Комплексные числа как структуры C](https://python-all.ru/3.16/c-api/complex.html#complex-numbers-as-c-structures)4445## Объекты последовательностей4647Общие операции над объектами последовательностей были рассмотрены в предыдущей главе; в этом разделе рассматриваются конкретные виды объектов последовательностей, встроенные в язык Python.4849- [Объекты bytes](https://python-all.ru/3.16/c-api/bytes.html)50- [PyBytesWriter](https://python-all.ru/3.16/c-api/bytes.html#pybyteswriter)5152  - [Создание, завершение, отбрасывание](https://python-all.ru/3.16/c-api/bytes.html#create-finish-discard)53  - [Высокоуровневый API](https://python-all.ru/3.16/c-api/bytes.html#high-level-api)54  - [Геттеры](https://python-all.ru/3.16/c-api/bytes.html#getters)55  - [Низкоуровневый API](https://python-all.ru/3.16/c-api/bytes.html#low-level-api)56- [Объекты массива байтов](https://python-all.ru/3.16/c-api/bytearray.html)5758  - [Макросы проверки типа](https://python-all.ru/3.16/c-api/bytearray.html#type-check-macros)59  - [Функции прямого API](https://python-all.ru/3.16/c-api/bytearray.html#direct-api-functions)60  - [Макросы](https://python-all.ru/3.16/c-api/bytearray.html#macros)61- [Объекты Unicode и кодеки](https://python-all.ru/3.16/c-api/unicode.html)6263  - [Объекты Unicode](https://python-all.ru/3.16/c-api/unicode.html#unicode-objects)6465    - [Тип Юникода](https://python-all.ru/3.16/c-api/unicode.html#unicode-type)66    - [Свойства символов Юникода](https://python-all.ru/3.16/c-api/unicode.html#unicode-character-properties)67    - [Создание и доступ к строкам Юникода](https://python-all.ru/3.16/c-api/unicode.html#creating-and-accessing-unicode-strings)68    - [Локальная кодировка](https://python-all.ru/3.16/c-api/unicode.html#locale-encoding)69    - [Кодировка файловой системы](https://python-all.ru/3.16/c-api/unicode.html#file-system-encoding)70    - [Поддержка wchar\_t](https://python-all.ru/3.16/c-api/unicode.html#wchar-t-support)71  - [Встроенные кодеки](https://python-all.ru/3.16/c-api/unicode.html#built-in-codecs)7273    - [Общие кодеки](https://python-all.ru/3.16/c-api/unicode.html#generic-codecs)74    - [Кодеки UTF-8](https://python-all.ru/3.16/c-api/unicode.html#utf-8-codecs)75    - [Кодеки UTF-32](https://python-all.ru/3.16/c-api/unicode.html#utf-32-codecs)76    - [Кодеки UTF-16](https://python-all.ru/3.16/c-api/unicode.html#utf-16-codecs)77    - [Кодеки UTF-7](https://python-all.ru/3.16/c-api/unicode.html#utf-7-codecs)78    - [Кодеки Unicode-Escape](https://python-all.ru/3.16/c-api/unicode.html#unicode-escape-codecs)79    - [Кодеки Raw-Unicode-Escape](https://python-all.ru/3.16/c-api/unicode.html#raw-unicode-escape-codecs)80    - [Кодеки Latin-1](https://python-all.ru/3.16/c-api/unicode.html#latin-1-codecs)81    - [Кодеки ASCII](https://python-all.ru/3.16/c-api/unicode.html#ascii-codecs)82    - [Кодеки символьной карты](https://python-all.ru/3.16/c-api/unicode.html#character-map-codecs)83    - [Кодеки MBCS для Windows](https://python-all.ru/3.16/c-api/unicode.html#mbcs-codecs-for-windows)84  - [Методы и слот-функции](https://python-all.ru/3.16/c-api/unicode.html#methods-and-slot-functions)85  - [PyUnicodeWriter](https://python-all.ru/3.16/c-api/unicode.html#pyunicodewriter)86  - [Устаревший API](https://python-all.ru/3.16/c-api/unicode.html#deprecated-api)87- [Кортежи](https://python-all.ru/3.16/c-api/tuple.html)88- [Объекты структурных последовательностей](https://python-all.ru/3.16/c-api/tuple.html#struct-sequence-objects)89- [Списки](https://python-all.ru/3.16/c-api/list.html)9091## Объекты-контейнеры9293- [Словари](https://python-all.ru/3.16/c-api/dict.html)9495  - [Объекты представлений словаря](https://python-all.ru/3.16/c-api/dict.html#dictionary-view-objects)96  - [Объекты замороженных словарей](https://python-all.ru/3.16/c-api/dict.html#frozen-dictionary-objects)97  - [Упорядоченные словари](https://python-all.ru/3.16/c-api/dict.html#ordered-dictionaries)98- [Множества](https://python-all.ru/3.16/c-api/set.html)99100  - [Устаревший API](https://python-all.ru/3.16/c-api/set.html#deprecated-api)101102## Объекты функций103104- [Объекты функций](https://python-all.ru/3.16/c-api/function.html)105- [Объекты методов экземпляра](https://python-all.ru/3.16/c-api/method.html)106- [Объекты методов](https://python-all.ru/3.16/c-api/method.html#method-objects)107- [Объекты-ячейки](https://python-all.ru/3.16/c-api/cell.html)108- [Объекты кода](https://python-all.ru/3.16/c-api/code.html)109- [Флаги объектов кода](https://python-all.ru/3.16/c-api/code.html#code-object-flags)110- [Дополнительная информация](https://python-all.ru/3.16/c-api/code.html#extra-information)111112## Другие объекты113114- [Объекты файлов](https://python-all.ru/3.16/c-api/file.html)115116  - [Частично устаревший API](https://python-all.ru/3.16/c-api/file.html#soft-deprecated-api)117- [Объекты модулей](https://python-all.ru/3.16/c-api/module.html)118119  - [Определение модуля](https://python-all.ru/3.16/c-api/module.html#module-definition)120121    - [Слоты метаданных](https://python-all.ru/3.16/c-api/module.html#metadata-slots)122    - [Слоты возможностей](https://python-all.ru/3.16/c-api/module.html#feature-slots)123    - [Слоты создания и инициализации](https://python-all.ru/3.16/c-api/module.html#creation-and-initialization-slots)124  - [Состояние модуля](https://python-all.ru/3.16/c-api/module.html#module-state)125126    - [Слоты для определения состояния модуля](https://python-all.ru/3.16/c-api/module.html#slots-for-defining-module-state)127    - [Токен модуля](https://python-all.ru/3.16/c-api/module.html#module-token)128  - [Динамическое создание модулей расширения](https://python-all.ru/3.16/c-api/module.html#creating-extension-modules-dynamically)129  - [Структура определения модуля](https://python-all.ru/3.16/c-api/module.html#module-definition-struct)130  - [Вспомогательные функции](https://python-all.ru/3.16/c-api/module.html#support-functions)131132    - [Поиск модуля (однофазовая инициализация)](https://python-all.ru/3.16/c-api/module.html#module-lookup-single-phase-initialization)133- [Объекты итераторов](https://python-all.ru/3.16/c-api/iterator.html)134135  - [Объекты range](https://python-all.ru/3.16/c-api/iterator.html#range-objects)136  - [Встроенные типы итераторов](https://python-all.ru/3.16/c-api/iterator.html#builtin-iterator-types)137  - [Прочие объекты итераторов](https://python-all.ru/3.16/c-api/iterator.html#other-iterator-objects)138- [Объекты дескрипторов](https://python-all.ru/3.16/c-api/descriptor.html)139140  - [Встроенные дескрипторы](https://python-all.ru/3.16/c-api/descriptor.html#built-in-descriptors)141- [Объекты срезов](https://python-all.ru/3.16/c-api/slice.html)142143  - [Объект Ellipsis](https://python-all.ru/3.16/c-api/slice.html#ellipsis-object)144- [Объекты memoryview](https://python-all.ru/3.16/c-api/memoryview.html)145- [Объекты буфера pickle](https://python-all.ru/3.16/c-api/picklebuffer.html)146- [Объекты слабых ссылок](https://python-all.ru/3.16/c-api/weakref.html)147- [Капсулы](https://python-all.ru/3.16/c-api/capsule.html)148- [Сторожевые объекты](https://python-all.ru/3.16/c-api/sentinel.html)149- [Объекты фреймов](https://python-all.ru/3.16/c-api/frame.html)150151  - [Прокси локальных переменных фрейма](https://python-all.ru/3.16/c-api/frame.html#frame-locals-proxies)152  - [Устаревшие API для локальных переменных](https://python-all.ru/3.16/c-api/frame.html#legacy-local-variable-apis)153  - [Внутренние фреймы](https://python-all.ru/3.16/c-api/frame.html#internal-frames)154- [Объекты-генераторы](https://python-all.ru/3.16/c-api/gen.html)155156  - [Объекты асинхронных генераторов](https://python-all.ru/3.16/c-api/gen.html#asynchronous-generator-objects)157  - [Устаревший API](https://python-all.ru/3.16/c-api/gen.html#deprecated-api)158- [Объекты корутин](https://python-all.ru/3.16/c-api/coro.html)159- [Объекты контекстных переменных](https://python-all.ru/3.16/c-api/contextvars.html)160- [Объекты для аннотаций типов](https://python-all.ru/3.16/c-api/typehints.html)161162## C API для модулей расширения163164- [C API библиотеки curses](https://python-all.ru/3.16/c-api/curses.html)165- [Внутренние данные](https://python-all.ru/3.16/c-api/curses.html#internal-data)166- [Объекты datetime](https://python-all.ru/3.16/c-api/datetime.html)167- [Внутренние данные](https://python-all.ru/3.16/c-api/datetime.html#internal-data)168