Skip to content

Sync with CPython 3.10 #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
293 changes: 145 additions & 148 deletions extending/extending.po

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions howto/descriptor.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.10\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-26 16:47+0000\n"
"POT-Creation-Date: 2021-11-20 00:08+0000\n"
"PO-Revision-Date: 2018-05-23 14:36+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand Down Expand Up @@ -929,18 +929,18 @@ msgid ""
"`staticmethod` would look like this:"
msgstr ""

#: ../../howto/descriptor.rst:1285
#: ../../howto/descriptor.rst:1292
msgid "Class methods"
msgstr ""

#: ../../howto/descriptor.rst:1287
#: ../../howto/descriptor.rst:1294
msgid ""
"Unlike static methods, class methods prepend the class reference to the "
"argument list before calling the function. This format is the same for "
"whether the caller is an object or a class:"
msgstr ""

#: ../../howto/descriptor.rst:1305
#: ../../howto/descriptor.rst:1312
msgid ""
"This behavior is useful whenever the method only needs to have a class "
"reference and does not rely on data stored in a specific instance. One use "
Expand All @@ -949,68 +949,68 @@ msgid ""
"of keys. The pure Python equivalent is:"
msgstr ""

#: ../../howto/descriptor.rst:1322
#: ../../howto/descriptor.rst:1329
msgid "Now a new dictionary of unique keys can be constructed like this:"
msgstr ""

#: ../../howto/descriptor.rst:1332
#: ../../howto/descriptor.rst:1339
msgid ""
"Using the non-data descriptor protocol, a pure Python version of :func:"
"`classmethod` would look like this:"
msgstr ""

#: ../../howto/descriptor.rst:1381
#: ../../howto/descriptor.rst:1388
msgid ""
"The code path for ``hasattr(type(self.f), '__get__')`` was added in Python "
"3.9 and makes it possible for :func:`classmethod` to support chained "
"decorators. For example, a classmethod and property could be chained "
"together:"
msgstr ""

#: ../../howto/descriptor.rst:1401
#: ../../howto/descriptor.rst:1408
msgid "Member objects and __slots__"
msgstr ""

#: ../../howto/descriptor.rst:1403
#: ../../howto/descriptor.rst:1410
msgid ""
"When a class defines ``__slots__``, it replaces instance dictionaries with a "
"fixed-length array of slot values. From a user point of view that has "
"several effects:"
msgstr ""

#: ../../howto/descriptor.rst:1407
#: ../../howto/descriptor.rst:1414
msgid ""
"1. Provides immediate detection of bugs due to misspelled attribute "
"assignments. Only attribute names specified in ``__slots__`` are allowed:"
msgstr ""

#: ../../howto/descriptor.rst:1423
#: ../../howto/descriptor.rst:1430
msgid ""
"2. Helps create immutable objects where descriptors manage access to private "
"attributes stored in ``__slots__``:"
msgstr ""

#: ../../howto/descriptor.rst:1458
#: ../../howto/descriptor.rst:1465
msgid ""
"3. Saves memory. On a 64-bit Linux build, an instance with two attributes "
"takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight "
"design pattern <https://en.wikipedia.org/wiki/Flyweight_pattern>`_ likely "
"only matters when a large number of instances are going to be created."
msgstr ""

#: ../../howto/descriptor.rst:1463
#: ../../howto/descriptor.rst:1470
msgid ""
"4. Improves speed. Reading instance variables is 35% faster with "
"``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)."
msgstr ""

#: ../../howto/descriptor.rst:1466
#: ../../howto/descriptor.rst:1473
msgid ""
"5. Blocks tools like :func:`functools.cached_property` which require an "
"instance dictionary to function correctly:"
msgstr ""

#: ../../howto/descriptor.rst:1488
#: ../../howto/descriptor.rst:1495
msgid ""
"It is not possible to create an exact drop-in pure Python version of "
"``__slots__`` because it requires direct access to C structures and control "
Expand All @@ -1020,36 +1020,36 @@ msgid ""
"managed by member descriptors:"
msgstr ""

#: ../../howto/descriptor.rst:1531
#: ../../howto/descriptor.rst:1538
msgid ""
"The :meth:`type.__new__` method takes care of adding member objects to class "
"variables:"
msgstr ""

#: ../../howto/descriptor.rst:1547
#: ../../howto/descriptor.rst:1554
msgid ""
"The :meth:`object.__new__` method takes care of creating instances that have "
"slots instead of an instance dictionary. Here is a rough simulation in pure "
"Python:"
msgstr ""

#: ../../howto/descriptor.rst:1582
#: ../../howto/descriptor.rst:1589
msgid ""
"To use the simulation in a real class, just inherit from :class:`Object` and "
"set the :term:`metaclass` to :class:`Type`:"
msgstr ""

#: ../../howto/descriptor.rst:1596
#: ../../howto/descriptor.rst:1603
msgid ""
"At this point, the metaclass has loaded member objects for *x* and *y*::"
msgstr ""

#: ../../howto/descriptor.rst:1617
#: ../../howto/descriptor.rst:1624
msgid ""
"When instances are created, they have a ``slot_values`` list where the "
"attributes are stored:"
msgstr ""

#: ../../howto/descriptor.rst:1629
#: ../../howto/descriptor.rst:1636
msgid "Misspelled or unassigned attributes will raise an exception:"
msgstr ""
Loading