File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- {"translation" : " 89.31%" , "updated_at" : " 2023-08-05T15 :57:03Z " }
1+ {"translation" : " 89.31%" , "updated_at" : " 2023-08-05T16 :57:04Z " }
Original file line number Diff line number Diff line change @@ -2281,6 +2281,9 @@ msgid ""
22812281":meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered "
22822282"true."
22832283msgstr ""
2284+ "调用此方法以实现真值检测以及内置的 ``bool()`` 操作;应该返回 ``False`` 或 ``True``。 当未定义此方法时,则在定义了 "
2285+ ":meth:`~object.__len__` 的情况下将调用它,如果其结果不为零则该对象将被视为具有真值。 如果一个类的 "
2286+ ":meth:`!__len__` 或 :meth:`!__bool__` 均未定义,则其所有实例都将被视为具有真值。"
22842287
22852288#: ../../reference/datamodel.rst:1606
22862289msgid "Customizing attribute access"
@@ -3536,6 +3539,8 @@ msgid ""
35363539"define a :meth:`~object.__bool__` method and whose :meth:`!__len__` method "
35373540"returns zero is considered to be false in a Boolean context."
35383541msgstr ""
3542+ "调用此方法以实现内置函数 :func:`len`。 应该返回对象的长度,以一个 ``>=`` 0 的整数表示。 此外,如果一个对象未定义 "
3543+ ":meth:`~object.__bool__` 方法而其 :meth:`!__len__` 方法返回值为零则它在布尔运算中将被视为具有假值。"
35393544
35403545#: ../../reference/datamodel.rst:2502
35413546msgid ""
@@ -3545,6 +3550,9 @@ msgid ""
35453550":exc:`!OverflowError` by truth value testing, an object must define a "
35463551":meth:`~object.__bool__` method."
35473552msgstr ""
3553+ "在 CPython 中,要求长度最大只能为 :data:`sys.maxsize`。 如果长度大于 :data:`!sys.maxsize` 则某些特性"
3554+ " (如 :func:`len`) 可能会引发 :exc:`OverflowError`。 要防止真值测试引发 "
3555+ ":exc:`!OverflowError`,对象必须定义 :meth:`~object.__bool__` 方法。"
35483556
35493557#: ../../reference/datamodel.rst:2511
35503558msgid ""
You can’t perform that action at this time.
0 commit comments