Teks sumber — English
Terjemahan — Bahasa Indonesia
Unicode Objects and Codecs
Unicode Objects
Objek Unicode
Since the implementation of :pep:`393` in Python 3.3, Unicode objects internally use a variety of representations, in order to allow handling the complete range of Unicode characters while staying memory efficient. There are special cases for strings where all code points are below 128, 256, or 65536; otherwise, code points must be below 1114112 (which is the full Unicode range).
These subtypes of :c:type:`PyObject` represent a Python Unicode object. In almost all cases, they shouldn't be used directly, since all API functions that deal with Unicode objects take and return :c:type:`PyObject` pointers.
The following APIs are C macros and static inlined functions for fast checks and access to internal read-only data of Unicode objects:
To create Unicode objects and access their basic sequence properties, use these APIs:
All other objects, including Unicode objects, cause a :exc:`TypeError` to be set.
The following APIs are capable of handling Unicode objects and strings on input (we refer to them as strings in the descriptions) and return Unicode objects or integers as appropriate.