8
8
msgstr ""
9
9
"Project-Id-Version : Python 3.10\n "
10
10
"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 "
12
12
"PO-Revision-Date : 2018-05-23 14:36+0000\n "
13
13
"Last-Translator : Adrian Liaw <adrianliaw2000@gmail.com>\n "
14
14
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -929,18 +929,18 @@ msgid ""
929
929
"`staticmethod` would look like this:"
930
930
msgstr ""
931
931
932
- #: ../../howto/descriptor.rst:1285
932
+ #: ../../howto/descriptor.rst:1292
933
933
msgid "Class methods"
934
934
msgstr ""
935
935
936
- #: ../../howto/descriptor.rst:1287
936
+ #: ../../howto/descriptor.rst:1294
937
937
msgid ""
938
938
"Unlike static methods, class methods prepend the class reference to the "
939
939
"argument list before calling the function. This format is the same for "
940
940
"whether the caller is an object or a class:"
941
941
msgstr ""
942
942
943
- #: ../../howto/descriptor.rst:1305
943
+ #: ../../howto/descriptor.rst:1312
944
944
msgid ""
945
945
"This behavior is useful whenever the method only needs to have a class "
946
946
"reference and does not rely on data stored in a specific instance. One use "
@@ -949,68 +949,68 @@ msgid ""
949
949
"of keys. The pure Python equivalent is:"
950
950
msgstr ""
951
951
952
- #: ../../howto/descriptor.rst:1322
952
+ #: ../../howto/descriptor.rst:1329
953
953
msgid "Now a new dictionary of unique keys can be constructed like this:"
954
954
msgstr ""
955
955
956
- #: ../../howto/descriptor.rst:1332
956
+ #: ../../howto/descriptor.rst:1339
957
957
msgid ""
958
958
"Using the non-data descriptor protocol, a pure Python version of :func:"
959
959
"`classmethod` would look like this:"
960
960
msgstr ""
961
961
962
- #: ../../howto/descriptor.rst:1381
962
+ #: ../../howto/descriptor.rst:1388
963
963
msgid ""
964
964
"The code path for ``hasattr(type(self.f), '__get__')`` was added in Python "
965
965
"3.9 and makes it possible for :func:`classmethod` to support chained "
966
966
"decorators. For example, a classmethod and property could be chained "
967
967
"together:"
968
968
msgstr ""
969
969
970
- #: ../../howto/descriptor.rst:1401
970
+ #: ../../howto/descriptor.rst:1408
971
971
msgid "Member objects and __slots__"
972
972
msgstr ""
973
973
974
- #: ../../howto/descriptor.rst:1403
974
+ #: ../../howto/descriptor.rst:1410
975
975
msgid ""
976
976
"When a class defines ``__slots__``, it replaces instance dictionaries with a "
977
977
"fixed-length array of slot values. From a user point of view that has "
978
978
"several effects:"
979
979
msgstr ""
980
980
981
- #: ../../howto/descriptor.rst:1407
981
+ #: ../../howto/descriptor.rst:1414
982
982
msgid ""
983
983
"1. Provides immediate detection of bugs due to misspelled attribute "
984
984
"assignments. Only attribute names specified in ``__slots__`` are allowed:"
985
985
msgstr ""
986
986
987
- #: ../../howto/descriptor.rst:1423
987
+ #: ../../howto/descriptor.rst:1430
988
988
msgid ""
989
989
"2. Helps create immutable objects where descriptors manage access to private "
990
990
"attributes stored in ``__slots__``:"
991
991
msgstr ""
992
992
993
- #: ../../howto/descriptor.rst:1458
993
+ #: ../../howto/descriptor.rst:1465
994
994
msgid ""
995
995
"3. Saves memory. On a 64-bit Linux build, an instance with two attributes "
996
996
"takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight "
997
997
"design pattern <https://en.wikipedia.org/wiki/Flyweight_pattern>`_ likely "
998
998
"only matters when a large number of instances are going to be created."
999
999
msgstr ""
1000
1000
1001
- #: ../../howto/descriptor.rst:1463
1001
+ #: ../../howto/descriptor.rst:1470
1002
1002
msgid ""
1003
1003
"4. Improves speed. Reading instance variables is 35% faster with "
1004
1004
"``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)."
1005
1005
msgstr ""
1006
1006
1007
- #: ../../howto/descriptor.rst:1466
1007
+ #: ../../howto/descriptor.rst:1473
1008
1008
msgid ""
1009
1009
"5. Blocks tools like :func:`functools.cached_property` which require an "
1010
1010
"instance dictionary to function correctly:"
1011
1011
msgstr ""
1012
1012
1013
- #: ../../howto/descriptor.rst:1488
1013
+ #: ../../howto/descriptor.rst:1495
1014
1014
msgid ""
1015
1015
"It is not possible to create an exact drop-in pure Python version of "
1016
1016
"``__slots__`` because it requires direct access to C structures and control "
@@ -1020,36 +1020,36 @@ msgid ""
1020
1020
"managed by member descriptors:"
1021
1021
msgstr ""
1022
1022
1023
- #: ../../howto/descriptor.rst:1531
1023
+ #: ../../howto/descriptor.rst:1538
1024
1024
msgid ""
1025
1025
"The :meth:`type.__new__` method takes care of adding member objects to class "
1026
1026
"variables:"
1027
1027
msgstr ""
1028
1028
1029
- #: ../../howto/descriptor.rst:1547
1029
+ #: ../../howto/descriptor.rst:1554
1030
1030
msgid ""
1031
1031
"The :meth:`object.__new__` method takes care of creating instances that have "
1032
1032
"slots instead of an instance dictionary. Here is a rough simulation in pure "
1033
1033
"Python:"
1034
1034
msgstr ""
1035
1035
1036
- #: ../../howto/descriptor.rst:1582
1036
+ #: ../../howto/descriptor.rst:1589
1037
1037
msgid ""
1038
1038
"To use the simulation in a real class, just inherit from :class:`Object` and "
1039
1039
"set the :term:`metaclass` to :class:`Type`:"
1040
1040
msgstr ""
1041
1041
1042
- #: ../../howto/descriptor.rst:1596
1042
+ #: ../../howto/descriptor.rst:1603
1043
1043
msgid ""
1044
1044
"At this point, the metaclass has loaded member objects for *x* and *y*::"
1045
1045
msgstr ""
1046
1046
1047
- #: ../../howto/descriptor.rst:1617
1047
+ #: ../../howto/descriptor.rst:1624
1048
1048
msgid ""
1049
1049
"When instances are created, they have a ``slot_values`` list where the "
1050
1050
"attributes are stored:"
1051
1051
msgstr ""
1052
1052
1053
- #: ../../howto/descriptor.rst:1629
1053
+ #: ../../howto/descriptor.rst:1636
1054
1054
msgid "Misspelled or unassigned attributes will raise an exception:"
1055
1055
msgstr ""
0 commit comments