@@ -1381,6 +1381,11 @@ msgid ""
13811381"larger than :const:`MAXYEAR`. Note that no time zone adjustments are done "
13821382"even if the input is an aware object."
13831383msgstr ""
1384+ "datetime2 是从中去掉的一段 timedelta 的结果,如果 ``timedelta.days`` > 0 则是在时间线上前进,如果 "
1385+ "``timedelta.days`` < 0 则后退。 结果具有与输入的 datetime 相同的 :attr:`~.datetime.tzinfo` "
1386+ "属性,并且操作完成后 datetime2 - datetime1 == timedelta。 如果 datetime2.year 将小于 "
1387+ ":const:`MINYEAR` 或大于 :const:`MAXYEAR` 则会引发 :exc:`OverflowError`。 "
1388+ "请注意即使输入的是一个感知型对象,该方法也不会进行时区调整。"
13841389
13851390#: ../../library/datetime.rst:966
13861391msgid ""
@@ -1389,13 +1394,17 @@ msgid ""
13891394" input datetime, and no time zone adjustments are done even if the input is "
13901395"aware."
13911396msgstr ""
1397+ "计算 datetime2 使得 datetime2 + timedelta == datetime1。 与相加操作一样,结果具有与输入的 "
1398+ "datetime 相同的 :attr:`~.datetime.tzinfo` 属性,即使输入的是一个感知型对象,该方法也不会进行时区调整。"
13921399
13931400#: ../../library/datetime.rst:971
13941401msgid ""
13951402"Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined "
13961403"only if both operands are naive, or if both are aware. If one is aware and "
13971404"the other is naive, :exc:`TypeError` is raised."
13981405msgstr ""
1406+ "从一个 :class:`.datetime` 减去一个 :class:`.datetime` 仅对两个操作数均为无知型或均为感知型时有定义。 "
1407+ "如果一个是感知型而另一个是无知型,则会引发 :exc:`TypeError`。"
13991408
14001409#: ../../library/datetime.rst:975
14011410msgid ""
@@ -1405,6 +1414,9 @@ msgid ""
14051414"such that ``datetime2 + t == datetime1``. No time zone adjustments are done"
14061415" in this case."
14071416msgstr ""
1417+ "如果两个操作数都是无知型,或都是感知型且具有相同的 :attr:`~.datetime.tzinfo` "
1418+ "属性,:attr:`~.datetime.tzinfo` 属性会被忽略,结果是一个使得 ``datetime2 + t == datetime1`` 的"
1419+ " :class:`timedelta` 对象 *t*。 在此情况下不会进行时区调整。"
14081420
14091421#: ../../library/datetime.rst:980
14101422msgid ""
@@ -1414,19 +1426,24 @@ msgid ""
14141426"(b.replace(tzinfo=None) - b.utcoffset())`` except that the implementation "
14151427"never overflows."
14161428msgstr ""
1429+ "如果两个操作数都是感知型且具有不同的 :attr:`~.datetime.tzinfo` 属性,``a-b`` 操作的行为就如同 *a* 和 *b* "
1430+ "被首先转换为无知型 UTC 日期时间。 结果将是 ``(a.replace(tzinfo=None) - a.utcoffset()) - "
1431+ "(b.replace(tzinfo=None) - b.utcoffset())`` 除非具体实现绝对不溢出。"
14171432
14181433#: ../../library/datetime.rst:986
14191434msgid ""
14201435"*datetime1* is considered less than *datetime2* when *datetime1* precedes "
14211436"*datetime2* in time."
1422- msgstr ""
1437+ msgstr "当 *datetime1* 的时间在 *datetime2* 之前则认为 *datetime1* 小于 *datetime2*。 "
14231438
14241439#: ../../library/datetime.rst:989
14251440msgid ""
14261441"If one comparand is naive and the other is aware, :exc:`TypeError` is raised"
14271442" if an order comparison is attempted. For equality comparisons, naive "
14281443"instances are never equal to aware instances."
14291444msgstr ""
1445+ "如果比较的一方是无知型而另一方是感知型,则如果尝试进行顺序比较将引发 :exc:`TypeError`。 "
1446+ "对于相等比较,无知型实例将永远不等于感知型实例。"
14301447
14311448#: ../../library/datetime.rst:993
14321449msgid ""
@@ -1437,12 +1454,16 @@ msgid ""
14371454"adjusted by subtracting their UTC offsets (obtained from "
14381455"``self.utcoffset()``)."
14391456msgstr ""
1457+ "如果两个比较方都是感知型,且具有相同的 :attr:`~.datetime.tzinfo` 属性,相同的 "
1458+ ":attr:`~.datetime.tzinfo` 属性会被忽略并对基本日期时间值进行比较。 如果两个比较方都是感知型且具有不同的 "
1459+ ":attr:`~.datetime.tzinfo` 属性,两个比较方将首先通过减去它们的 UTC 差值(使用 ``self.utcoffset()`` "
1460+ "获取)来进行调整。"
14401461
14411462#: ../../library/datetime.rst:999
14421463msgid ""
14431464"Equality comparisons between naive and aware :class:`.datetime` instances "
14441465"don't raise :exc:`TypeError`."
1445- msgstr ""
1466+ msgstr "无知型和感知型 :class:`.datetime` 实例之间的比较不会引发 :exc:`TypeError`。 "
14461467
14471468#: ../../library/datetime.rst:1005
14481469msgid ""
@@ -1456,6 +1477,11 @@ msgid ""
14561477":exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The "
14571478"latter cases return :const:`False` or :const:`True`, respectively."
14581479msgstr ""
1480+ "为了防止比较操作回退为默认的对象地址比较方案,datetime 比较通常会引发 :exc:`TypeError`,如果比较目标不同样为 "
1481+ ":class:`.datetime` 对象的话。 不过也可能会返回 ``NotImplemented`` 如果比较目标具有 "
1482+ ":meth:`timetuple` 属性的话。 这个钩子给予其他日期对象类型实现混合类型比较的机会。 否则,当 :class:`.datetime` "
1483+ "对象与不同类型的对象比较时将会引发 :exc:`TypeError`,除非 ``==`` 或 ``!=`` 比较。 后两种情况将分别返回 "
1484+ ":const:`False` 或 :const:`True`。"
14591485
14601486#: ../../library/datetime.rst:1015
14611487msgid ""
0 commit comments