66msgstr ""
77"Project-Id-Version : Python 3.13\n "
88"Report-Msgid-Bugs-To : \n "
9- "POT-Creation-Date : 2024-10-09 00:13 +0000\n "
9+ "POT-Creation-Date : 2024-12-23 12:45 +0000\n "
1010"PO-Revision-Date : YEAR-MO-DA HO:MI+ZONE\n "
1111"Last-Translator : FULL NAME <EMAIL@ADDRESS>\n "
1212"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -16,101 +16,118 @@ msgstr ""
1616"Content-Type : text/plain; charset=UTF-8\n "
1717"Content-Transfer-Encoding : 8bit\n "
1818
19- #: ../../howto/argparse-optparse.rst:7
20- msgid "Upgrading optparse code"
19+ #: ../../howto/argparse-optparse.rst:8
20+ #, fuzzy
21+ msgid "Migrating ``optparse`` code to ``argparse``"
2122msgstr "升級 optparse 程式碼"
2223
23- #: ../../howto/argparse-optparse.rst:9
24- msgid ""
25- "Originally, the :mod:`argparse` module had attempted to maintain "
26- "compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult "
27- "to extend transparently, particularly with the changes required to support "
28- "``nargs=`` specifiers and better usage messages. When most everything in :"
29- "mod:`optparse` had either been copy-pasted over or monkey-patched, it no "
30- "longer seemed practical to try to maintain the backwards compatibility."
31- msgstr ""
32-
33- #: ../../howto/argparse-optparse.rst:16
24+ #: ../../howto/argparse-optparse.rst:10
3425msgid ""
35- "The :mod:`argparse` module improves on the :mod:`optparse` module in a "
36- "number of ways including:"
26+ "The :mod:`argparse` module offers several higher level features not natively "
27+ "provided by the :mod:`optparse` module, including:"
3728msgstr ""
3829
39- #: ../../howto/argparse-optparse.rst:19
30+ #: ../../howto/argparse-optparse.rst:13
4031msgid "Handling positional arguments."
4132msgstr ""
4233
43- #: ../../howto/argparse-optparse.rst:20
34+ #: ../../howto/argparse-optparse.rst:14
4435msgid "Supporting subcommands."
4536msgstr ""
4637
47- #: ../../howto/argparse-optparse.rst:21
38+ #: ../../howto/argparse-optparse.rst:15
4839msgid "Allowing alternative option prefixes like ``+`` and ``/``."
4940msgstr ""
5041
51- #: ../../howto/argparse-optparse.rst:22
42+ #: ../../howto/argparse-optparse.rst:16
5243msgid "Handling zero-or-more and one-or-more style arguments."
5344msgstr ""
5445
55- #: ../../howto/argparse-optparse.rst:23
46+ #: ../../howto/argparse-optparse.rst:17
5647msgid "Producing more informative usage messages."
5748msgstr ""
5849
59- #: ../../howto/argparse-optparse.rst:24
50+ #: ../../howto/argparse-optparse.rst:18
6051msgid "Providing a much simpler interface for custom ``type`` and ``action``."
6152msgstr ""
6253
63- #: ../../howto/argparse-optparse.rst:26
64- msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:"
54+ #: ../../howto/argparse-optparse.rst:20
55+ msgid ""
56+ "Originally, the :mod:`argparse` module attempted to maintain compatibility "
57+ "with :mod:`optparse`. However, the fundamental design differences between "
58+ "supporting declarative command line option processing (while leaving "
59+ "positional argument processing to application code), and supporting both "
60+ "named options and positional arguments in the declarative interface mean "
61+ "that the API has diverged from that of ``optparse`` over time."
62+ msgstr ""
63+
64+ #: ../../howto/argparse-optparse.rst:27
65+ msgid ""
66+ "As described in :ref:`choosing-an-argument-parser`, applications that are "
67+ "currently using :mod:`optparse` and are happy with the way it works can just "
68+ "continue to use ``optparse``."
69+ msgstr ""
70+
71+ #: ../../howto/argparse-optparse.rst:31
72+ msgid ""
73+ "Application developers that are considering migrating should also review the "
74+ "list of intrinsic behavioural differences described in that section before "
75+ "deciding whether or not migration is desirable."
76+ msgstr ""
77+
78+ #: ../../howto/argparse-optparse.rst:35
79+ msgid ""
80+ "For applications that do choose to migrate from :mod:`optparse` to :mod:"
81+ "`argparse`, the following suggestions should be helpful:"
6582msgstr ""
6683
67- #: ../../howto/argparse-optparse.rst:28
84+ #: ../../howto/argparse-optparse.rst:38
6885msgid ""
6986"Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:"
7087"`ArgumentParser.add_argument` calls."
7188msgstr ""
7289
73- #: ../../howto/argparse-optparse.rst:31
90+ #: ../../howto/argparse-optparse.rst:41
7491msgid ""
7592"Replace ``(options, args) = parser.parse_args()`` with ``args = parser."
7693"parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls "
7794"for the positional arguments. Keep in mind that what was previously called "
7895"``options``, now in the :mod:`argparse` context is called ``args``."
7996msgstr ""
8097
81- #: ../../howto/argparse-optparse.rst:36
98+ #: ../../howto/argparse-optparse.rst:46
8299msgid ""
83100"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :"
84101"meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:"
85102"`~ArgumentParser.parse_args`."
86103msgstr ""
87104
88- #: ../../howto/argparse-optparse.rst:40
105+ #: ../../howto/argparse-optparse.rst:50
89106msgid ""
90107"Replace callback actions and the ``callback_*`` keyword arguments with "
91108"``type`` or ``action`` arguments."
92109msgstr ""
93110
94- #: ../../howto/argparse-optparse.rst:43
111+ #: ../../howto/argparse-optparse.rst:53
95112msgid ""
96113"Replace string names for ``type`` keyword arguments with the corresponding "
97114"type objects (e.g. int, float, complex, etc)."
98115msgstr ""
99116
100- #: ../../howto/argparse-optparse.rst:46
117+ #: ../../howto/argparse-optparse.rst:56
101118msgid ""
102119"Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse."
103120"OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`."
104121msgstr ""
105122
106- #: ../../howto/argparse-optparse.rst:50
123+ #: ../../howto/argparse-optparse.rst:60
107124msgid ""
108125"Replace strings with implicit arguments such as ``%default`` or ``%prog`` "
109126"with the standard Python syntax to use dictionaries to format strings, that "
110127"is, ``%(default)s`` and ``%(prog)s``."
111128msgstr ""
112129
113- #: ../../howto/argparse-optparse.rst:54
130+ #: ../../howto/argparse-optparse.rst:64
114131msgid ""
115132"Replace the OptionParser constructor ``version`` argument with a call to "
116133"``parser.add_argument('--version', action='version', version='<the "
0 commit comments