Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd52bda3

Browse files
Sync with CPython 3.10 (#142)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent4b26452 commitd52bda3

16 files changed

+1921
-1777
lines changed

‎extending/extending.po

Lines changed: 145 additions & 148 deletions
Large diffs are not rendered by default.

‎howto/descriptor.po

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
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:"
930930
msgstr""
931931

932-
#:../../howto/descriptor.rst:1285
932+
#:../../howto/descriptor.rst:1292
933933
msgid"Class methods"
934934
msgstr""
935935

936-
#:../../howto/descriptor.rst:1287
936+
#:../../howto/descriptor.rst:1294
937937
msgid""
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:"
941941
msgstr""
942942

943-
#:../../howto/descriptor.rst:1305
943+
#:../../howto/descriptor.rst:1312
944944
msgid""
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:"
950950
msgstr""
951951

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

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

962-
#:../../howto/descriptor.rst:1381
962+
#:../../howto/descriptor.rst:1388
963963
msgid""
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:"
968968
msgstr""
969969

970-
#:../../howto/descriptor.rst:1401
970+
#:../../howto/descriptor.rst:1408
971971
msgid"Member objects and __slots__"
972972
msgstr""
973973

974-
#:../../howto/descriptor.rst:1403
974+
#:../../howto/descriptor.rst:1410
975975
msgid""
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:"
979979
msgstr""
980980

981-
#:../../howto/descriptor.rst:1407
981+
#:../../howto/descriptor.rst:1414
982982
msgid""
983983
"1. Provides immediate detection of bugs due to misspelled attribute "
984984
"assignments. Only attribute names specified in ``__slots__`` are allowed:"
985985
msgstr""
986986

987-
#:../../howto/descriptor.rst:1423
987+
#:../../howto/descriptor.rst:1430
988988
msgid""
989989
"2. Helps create immutable objects where descriptors manage access to private "
990990
"attributes stored in ``__slots__``:"
991991
msgstr""
992992

993-
#:../../howto/descriptor.rst:1458
993+
#:../../howto/descriptor.rst:1465
994994
msgid""
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."
999999
msgstr""
10001000

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

1007-
#:../../howto/descriptor.rst:1466
1007+
#:../../howto/descriptor.rst:1473
10081008
msgid""
10091009
"5. Blocks tools like :func:`functools.cached_property` which require an "
10101010
"instance dictionary to function correctly:"
10111011
msgstr""
10121012

1013-
#:../../howto/descriptor.rst:1488
1013+
#:../../howto/descriptor.rst:1495
10141014
msgid""
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:"
10211021
msgstr""
10221022

1023-
#:../../howto/descriptor.rst:1531
1023+
#:../../howto/descriptor.rst:1538
10241024
msgid""
10251025
"The :meth:`type.__new__` method takes care of adding member objects to class "
10261026
"variables:"
10271027
msgstr""
10281028

1029-
#:../../howto/descriptor.rst:1547
1029+
#:../../howto/descriptor.rst:1554
10301030
msgid""
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:"
10341034
msgstr""
10351035

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

1042-
#:../../howto/descriptor.rst:1596
1042+
#:../../howto/descriptor.rst:1603
10431043
msgid""
10441044
"At this point, the metaclass has loaded member objects for *x* and *y*::"
10451045
msgstr""
10461046

1047-
#:../../howto/descriptor.rst:1617
1047+
#:../../howto/descriptor.rst:1624
10481048
msgid""
10491049
"When instances are created, they have a ``slot_values`` list where the "
10501050
"attributes are stored:"
10511051
msgstr""
10521052

1053-
#:../../howto/descriptor.rst:1629
1053+
#:../../howto/descriptor.rst:1636
10541054
msgid"Misspelled or unassigned attributes will raise an exception:"
10551055
msgstr""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp