@@ -2010,19 +2010,23 @@ msgid ""
20102010"make changes (such as ``getcontext().prec=10``) without interfering with "
20112011"other threads."
20122012msgstr ""
2013+ ":func:`getcontext` 函数会为每个线程访问不同的 :class:`Context` 对象。 具有单独线程上下文意味着线程可以修改上下文 "
2014+ "(例如 ``getcontext().prec=10``) 而不影响其他线程。"
20132015
20142016#: ../../library/decimal.rst:1782
20152017msgid ""
20162018"Likewise, the :func:`setcontext` function automatically assigns its target "
20172019"to the current thread."
2018- msgstr ""
2020+ msgstr "类似的 :func:`setcontext` 会为当前上下文的目标自动赋值。 "
20192021
20202022#: ../../library/decimal.rst:1785
20212023msgid ""
20222024"If :func:`setcontext` has not been called before :func:`getcontext`, then "
20232025":func:`getcontext` will automatically create a new context for use in the "
20242026"current thread."
20252027msgstr ""
2028+ "如果在调用 :func:`setcontext` 之前调用了 :func:`getcontext`,则 :func:`getcontext` "
2029+ "将自动创建一个新的上下文在当前线程中使用。"
20262030
20272031#: ../../library/decimal.rst:1789
20282032msgid ""
@@ -2032,6 +2036,9 @@ msgid ""
20322036"This should be done *before* any threads are started so that there won't be "
20332037"a race condition between threads calling :func:`getcontext`. For example::"
20342038msgstr ""
2039+ "新的上下文拷贝自一个名为 *DefaultContext* 的原型上下文。 要控制默认值以便每个线程在应用运行期间都使用相同的值,可以直接修改 "
2040+ "*DefaultContext* 对象。 这应当在任何线程启动 *之前* 完成以使得调用 :func:`getcontext` "
2041+ "的线程之间不会产生竞争条件。 例如::"
20352042
20362043#: ../../library/decimal.rst:1814
20372044msgid "Recipes"
@@ -2041,7 +2048,7 @@ msgstr "例程"
20412048msgid ""
20422049"Here are a few recipes that serve as utility functions and that demonstrate "
20432050"ways to work with the :class:`Decimal` class::"
2044- msgstr ""
2051+ msgstr "以下是一些用作工具函数的例程,它们演示了使用 :class:`Decimal` 类的各种方式:: "
20452052
20462053#: ../../library/decimal.rst:1971
20472054msgid "Decimal FAQ"
@@ -2051,24 +2058,26 @@ msgstr "Decimal FAQ"
20512058msgid ""
20522059"Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way "
20532060"to minimize typing when using the interactive interpreter?"
2054- msgstr ""
2061+ msgstr "Q. 总是输入 ``decimal.Decimal('1234.5')`` 是否过于笨拙。 在使用交互解释器时有没有最小化输入量的方式? "
20552062
20562063#: ../../library/decimal.rst:1976
20572064msgid "A. Some users abbreviate the constructor to just a single letter:"
2058- msgstr ""
2065+ msgstr "A. 有些用户会将构造器简写为一个字母: "
20592066
20602067#: ../../library/decimal.rst:1982
20612068msgid ""
20622069"Q. In a fixed-point application with two decimal places, some inputs have "
20632070"many places and need to be rounded. Others are not supposed to have excess "
20642071"digits and need to be validated. What methods should be used?"
20652072msgstr ""
2073+ "Q. 在带有两个十进制位的定点数应用中,有些输入值具有许多位,需要被舍入。 另一些数则不应具有多余位,需要验证有效性。 这种情况应该用什么方法?"
20662074
20672075#: ../../library/decimal.rst:1986
20682076msgid ""
20692077"A. The :meth:`quantize` method rounds to a fixed number of decimal places. "
20702078"If the :const:`Inexact` trap is set, it is also useful for validation:"
20712079msgstr ""
2080+ "A. 用 :meth:`quantize` 方法舍入到固定数量的十进制位。 如果设置了 :const:`Inexact` 陷阱,它也适用于验证有效性:"
20722081
20732082#: ../../library/decimal.rst:2004
20742083msgid ""
0 commit comments