88msgstr ""
99"Project-Id-Version :Python 3.10\n "
1010"Report-Msgid-Bugs-To :\n "
11- "POT-Creation-Date :2021-10-26 16:47 +0000\n "
11+ "POT-Creation-Date :2021-11-20 00:08 +0000\n "
1212"PO-Revision-Date :2018-05-23 14:36+0000\n "
1313"Last-Translator :Adrian Liaw <adrianliaw2000@gmail.com>\n "
1414"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -929,18 +929,18 @@ msgid ""
929929"`staticmethod` would look like this:"
930930msgstr ""
931931
932- #: ../../howto/descriptor.rst:1285
932+ #: ../../howto/descriptor.rst:1292
933933msgid "Class methods"
934934msgstr ""
935935
936- #: ../../howto/descriptor.rst:1287
936+ #: ../../howto/descriptor.rst:1294
937937msgid ""
938938"Unlike static methods, class methods prepend the class reference to the "
939939"argument list before calling the function. This format is the same for "
940940"whether the caller is an object or a class:"
941941msgstr ""
942942
943- #: ../../howto/descriptor.rst:1305
943+ #: ../../howto/descriptor.rst:1312
944944msgid ""
945945"This behavior is useful whenever the method only needs to have a class "
946946"reference and does not rely on data stored in a specific instance. One use "
@@ -949,68 +949,68 @@ msgid ""
949949"of keys. The pure Python equivalent is:"
950950msgstr ""
951951
952- #: ../../howto/descriptor.rst:1322
952+ #: ../../howto/descriptor.rst:1329
953953msgid "Now a new dictionary of unique keys can be constructed like this:"
954954msgstr ""
955955
956- #: ../../howto/descriptor.rst:1332
956+ #: ../../howto/descriptor.rst:1339
957957msgid ""
958958"Using the non-data descriptor protocol, a pure Python version of :func:"
959959"`classmethod` would look like this:"
960960msgstr ""
961961
962- #: ../../howto/descriptor.rst:1381
962+ #: ../../howto/descriptor.rst:1388
963963msgid ""
964964"The code path for ``hasattr(type(self.f), '__get__')`` was added in Python "
965965"3.9 and makes it possible for :func:`classmethod` to support chained "
966966"decorators. For example, a classmethod and property could be chained "
967967"together:"
968968msgstr ""
969969
970- #: ../../howto/descriptor.rst:1401
970+ #: ../../howto/descriptor.rst:1408
971971msgid "Member objects and __slots__"
972972msgstr ""
973973
974- #: ../../howto/descriptor.rst:1403
974+ #: ../../howto/descriptor.rst:1410
975975msgid ""
976976"When a class defines ``__slots__``, it replaces instance dictionaries with a "
977977"fixed-length array of slot values. From a user point of view that has "
978978"several effects:"
979979msgstr ""
980980
981- #: ../../howto/descriptor.rst:1407
981+ #: ../../howto/descriptor.rst:1414
982982msgid ""
983983"1. Provides immediate detection of bugs due to misspelled attribute "
984984"assignments. Only attribute names specified in ``__slots__`` are allowed:"
985985msgstr ""
986986
987- #: ../../howto/descriptor.rst:1423
987+ #: ../../howto/descriptor.rst:1430
988988msgid ""
989989"2. Helps create immutable objects where descriptors manage access to private "
990990"attributes stored in ``__slots__``:"
991991msgstr ""
992992
993- #: ../../howto/descriptor.rst:1458
993+ #: ../../howto/descriptor.rst:1465
994994msgid ""
995995"3. Saves memory. On a 64-bit Linux build, an instance with two attributes "
996996"takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight "
997997"design pattern <https://en.wikipedia.org/wiki/Flyweight_pattern>`_ likely "
998998"only matters when a large number of instances are going to be created."
999999msgstr ""
10001000
1001- #: ../../howto/descriptor.rst:1463
1001+ #: ../../howto/descriptor.rst:1470
10021002msgid ""
10031003"4. Improves speed. Reading instance variables is 35% faster with "
10041004"``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)."
10051005msgstr ""
10061006
1007- #: ../../howto/descriptor.rst:1466
1007+ #: ../../howto/descriptor.rst:1473
10081008msgid ""
10091009"5. Blocks tools like :func:`functools.cached_property` which require an "
10101010"instance dictionary to function correctly:"
10111011msgstr ""
10121012
1013- #: ../../howto/descriptor.rst:1488
1013+ #: ../../howto/descriptor.rst:1495
10141014msgid ""
10151015"It is not possible to create an exact drop-in pure Python version of "
10161016"``__slots__`` because it requires direct access to C structures and control "
@@ -1020,36 +1020,36 @@ msgid ""
10201020"managed by member descriptors:"
10211021msgstr ""
10221022
1023- #: ../../howto/descriptor.rst:1531
1023+ #: ../../howto/descriptor.rst:1538
10241024msgid ""
10251025"The :meth:`type.__new__` method takes care of adding member objects to class "
10261026"variables:"
10271027msgstr ""
10281028
1029- #: ../../howto/descriptor.rst:1547
1029+ #: ../../howto/descriptor.rst:1554
10301030msgid ""
10311031"The :meth:`object.__new__` method takes care of creating instances that have "
10321032"slots instead of an instance dictionary. Here is a rough simulation in pure "
10331033"Python:"
10341034msgstr ""
10351035
1036- #: ../../howto/descriptor.rst:1582
1036+ #: ../../howto/descriptor.rst:1589
10371037msgid ""
10381038"To use the simulation in a real class, just inherit from :class:`Object` and "
10391039"set the :term:`metaclass` to :class:`Type`:"
10401040msgstr ""
10411041
1042- #: ../../howto/descriptor.rst:1596
1042+ #: ../../howto/descriptor.rst:1603
10431043msgid ""
10441044"At this point, the metaclass has loaded member objects for *x* and *y*::"
10451045msgstr ""
10461046
1047- #: ../../howto/descriptor.rst:1617
1047+ #: ../../howto/descriptor.rst:1624
10481048msgid ""
10491049"When instances are created, they have a ``slot_values`` list where the "
10501050"attributes are stored:"
10511051msgstr ""
10521052
1053- #: ../../howto/descriptor.rst:1629
1053+ #: ../../howto/descriptor.rst:1636
10541054msgid "Misspelled or unassigned attributes will raise an exception:"
10551055msgstr ""