@@ -2756,27 +2756,35 @@ msgid ""
27562756"value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and "
27572757":attr:`~Option.TYPED_ACTIONS`."
27582758msgstr ""
2759+ "``\" extend\" `` 既预期在命令行接受一个值又会将该值保存到某处,因此它同时被归类于 "
2760+ ":attr:`~Option.STORE_ACTIONS` 和 :attr:`~Option.TYPED_ACTIONS`。"
27592761
27602762#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:2015
27612763msgid ""
27622764"to ensure that :mod:`optparse` assigns the default type of ``\" string\" `` to"
27632765" ``\" extend\" `` actions, we put the ``\" extend\" `` action in "
27642766":attr:`~Option.ALWAYS_TYPED_ACTIONS` as well."
27652767msgstr ""
2768+ "为确保 :mod:`optparse` 将 ``\" string\" `` 的默认类型赋值给 ``\" extend\" `` 动作,我们同时将 "
2769+ "``\" extend\" `` 动作归类于 :attr:`~Option.ALWAYS_TYPED_ACTIONS`。"
27662770
27672771#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:2019
27682772msgid ""
27692773":meth:`MyOption.take_action` implements just this one new action, and passes"
27702774" control back to :meth:`Option.take_action` for the standard :mod:`optparse`"
27712775" actions."
27722776msgstr ""
2777+ ":meth:`MyOption.take_action` 只实现了这一个新动作,并将控制权回传给 :meth:`Option.take_action` "
2778+ "以执行标准的 :mod:`optparse` 动作。"
27732779
27742780#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:2023
27752781msgid ""
27762782"``values`` is an instance of the optparse_parser.Values class, which "
27772783"provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` "
27782784"is essentially :func:`getattr` with a safety valve; it is called as ::"
27792785msgstr ""
2786+ "``values`` 是 optparse_parser.Values 类的一个实例,该类提供了非常有用的 :meth:`ensure_value` "
2787+ "方法。 :meth:`ensure_value` 实际就是一个带有安全阀的 :func:`getattr`;它的调用形式为 ::"
27802788
27812789#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:2029
27822790msgid ""
@@ -2790,3 +2798,8 @@ msgid ""
27902798"destinations in question; they can just leave the default as ``None`` and "
27912799":meth:`ensure_value` will take care of getting it right when it's needed."
27922800msgstr ""
2801+ "如果 ``values`` 的 ``attr`` 属性不存在或为 ``None``,则 ensure_value() 会先将其设为 "
2802+ "``value``,然后返回该值。 这非常适用于 ``\" extend\" ``, ``\" append\" `` 和 ``\" count\" `` "
2803+ "等动作,它们会将数据累积在一个变量中并预期该变量属于特定的类型(前两项是一个列表,后一项是一个整数)。 使用 :meth:`ensure_value` "
2804+ "意味着使用你的动作的脚本无需关心为相应的选项目标设置默认值;可以简单地保持默认的 ``None`` 则 :meth:`ensure_value` "
2805+ "将在必要时负责为其设置适当的值。"