@@ -18,7 +18,7 @@ msgid ""
18
18
msgstr ""
19
19
"Project-Id-Version : Python 3.13\n "
20
20
"Report-Msgid-Bugs-To : \n "
21
- "POT-Creation-Date : 2025-01-17 14:16 +0000\n "
21
+ "POT-Creation-Date : 2025-02-03 17:40 +0000\n "
22
22
"PO-Revision-Date : 2021-06-28 00:53+0000\n "
23
23
"Last-Translator : Freesand Leo <yuqinju@163.com>, 2025\n "
24
24
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -499,6 +499,8 @@ msgid ""
499
499
":meth:`~object.__set_name__` so that the field names would be recorded. "
500
500
"Here we call :func:`vars` to look up the descriptor without triggering it:"
501
501
msgstr ""
502
+ "交互式会话显示 :class:`!Person` 类调用了 :meth:`~object.__set_name__` 以使字段名称可被记录。 "
503
+ "在这里我们调用 :func:`vars` 来查找描述器而不触发它:"
502
504
503
505
#: ../../howto/descriptor.rst:260
504
506
msgid ""
@@ -558,6 +560,8 @@ msgid ""
558
560
":meth:`~object.__get__`, :meth:`~object.__set__`, or "
559
561
":meth:`~object.__delete__`."
560
562
msgstr ""
563
+ ":term:`descriptor` 是指任何定义了 :meth:`~object.__get__`, :meth:`~object.__set__` "
564
+ "或 :meth:`~object.__delete__` 的对象。"
561
565
562
566
#: ../../howto/descriptor.rst:300
563
567
msgid ""
@@ -566,6 +570,8 @@ msgid ""
566
570
" where it was created or the name of class variable it was assigned to. "
567
571
"(This method, if present, is called even if the class is not a descriptor.)"
568
572
msgstr ""
573
+ "作为可选项,描述器可以有 :meth:`~object.__set_name__` 方法。 "
574
+ "这仅会被用于当描述器需要知道创建它的类或它被分配的类变量名称等场合。 (此方法如果存在,那么即使所在类并不是一个描述器仍会被调用。)"
569
575
570
576
#: ../../howto/descriptor.rst:305
571
577
msgid ""
@@ -635,6 +641,7 @@ msgid ""
635
641
"This :class:`!Validator` class is both an :term:`abstract base class` and a "
636
642
"managed attribute descriptor:"
637
643
msgstr ""
644
+ "这个 :class:`!Validator` 类既是一个 :term:`abstract base class` 也是一个被管理的属性描述器:"
638
645
639
646
#: ../../howto/descriptor.rst:343
640
647
msgid ""
@@ -679,6 +686,7 @@ msgid ""
679
686
"Custom validators need to inherit from :class:`!Validator` and must supply a"
680
687
" :meth:`!validate` method to test various restrictions as needed."
681
688
msgstr ""
689
+ "自定义验证器必须继承自 :class:`!Validator` 并且必须提供 :meth:`!validate` 方法以根据需要测试各种约束。"
682
690
683
691
#: ../../howto/descriptor.rst:368
684
692
msgid "Custom validators"
@@ -1810,6 +1818,11 @@ msgid ""
1810
1818
">>> d.f.__self__\n"
1811
1819
"<__main__.D object at 0x00B18C90>"
1812
1820
msgstr ""
1821
+ ">>> d.f.__func__\n"
1822
+ "<function D.f at 0x00C45070>\n"
1823
+ "\n"
1824
+ ">>> d.f.__self__\n"
1825
+ "<__main__.D object at 0x00B18C90>"
1813
1826
1814
1827
#: ../../howto/descriptor.rst:1261
1815
1828
msgid ""
@@ -1965,6 +1978,20 @@ msgid ""
1965
1978
" def __call__(self, *args, **kwds):\n"
1966
1979
" return self.f(*args, **kwds)"
1967
1980
msgstr ""
1981
+ "import functools\n"
1982
+ "\n"
1983
+ "class StaticMethod:\n"
1984
+ " \" Emulate PyStaticMethod_Type() in Objects/funcobject.c\" \n"
1985
+ "\n"
1986
+ " def __init__(self, f):\n"
1987
+ " self.f = f\n"
1988
+ " functools.update_wrapper(self, f)\n"
1989
+ "\n"
1990
+ " def __get__(self, obj, objtype=None):\n"
1991
+ " return self.f\n"
1992
+ "\n"
1993
+ " def __call__(self, *args, **kwds):\n"
1994
+ " return self.f(*args, **kwds)"
1968
1995
1969
1996
#: ../../howto/descriptor.rst:1348
1970
1997
msgid ""
@@ -1997,6 +2024,10 @@ msgid ""
1997
2024
" def f(cls, x):\n"
1998
2025
" return cls.__name__, x"
1999
2026
msgstr ""
2027
+ "class F:\n"
2028
+ " @classmethod\n"
2029
+ " def f(cls, x):\n"
2030
+ " return cls.__name__, x"
2000
2031
2001
2032
#: ../../howto/descriptor.rst:1430
2002
2033
msgid ""
@@ -2005,6 +2036,10 @@ msgid ""
2005
2036
">>> F().f(3)\n"
2006
2037
"('F', 3)"
2007
2038
msgstr ""
2039
+ ">>> F.f(3)\n"
2040
+ "('F', 3)\n"
2041
+ ">>> F().f(3)\n"
2042
+ "('F', 3)"
2008
2043
2009
2044
#: ../../howto/descriptor.rst:1437
2010
2045
msgid ""
@@ -2028,6 +2063,14 @@ msgid ""
2028
2063
" d[key] = value\n"
2029
2064
" return d"
2030
2065
msgstr ""
2066
+ "class Dict(dict):\n"
2067
+ " @classmethod\n"
2068
+ " def fromkeys(cls, iterable, value=None):\n"
2069
+ " \" Emulate dict_fromkeys() in Objects/dictobject.c\" \n"
2070
+ " d = cls()\n"
2071
+ " for key in iterable:\n"
2072
+ " d[key] = value\n"
2073
+ " return d"
2031
2074
2032
2075
#: ../../howto/descriptor.rst:1454
2033
2076
msgid "Now a new dictionary of unique keys can be constructed like this:"
0 commit comments