# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2016 # Matt Wang , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-09-24 20:28+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/codeop.rst:2 msgid ":mod:`!codeop` --- Compile Python code" msgstr ":mod:`!codeop` --- 編譯 Python 程式碼" #: ../../library/codeop.rst:10 msgid "**Source code:** :source:`Lib/codeop.py`" msgstr "**原始碼:**\\ :source:`Lib/codeop.py`" #: ../../library/codeop.rst:14 msgid "" "The :mod:`codeop` module provides utilities upon which the Python read-eval-" "print loop can be emulated, as is done in the :mod:`code` module. As a " "result, you probably don't want to use the module directly; if you want to " "include such a loop in your program you probably want to use the :mod:`code` " "module instead." msgstr "" ":mod:`codeop` 模組提供了可以模擬 Python read-eval-print 循環的工具程式 " "(utilities),就像在 :mod:`code` 模組中所做的那樣。因此你可能不想直接使用該模" "組;如果你想在程式中包含這樣的循環,你可能需要使用 :mod:`code` 模組。" #: ../../library/codeop.rst:20 msgid "There are two parts to this job:" msgstr "這個任務有兩個部分:" #: ../../library/codeop.rst:22 msgid "" "Being able to tell if a line of input completes a Python statement: in " "short, telling whether to print '``>>>``' or '``...``' next." msgstr "" "能夠判斷一列輸入是否完成了一項 Python 陳述式:簡而言之,判斷接下來是列印 " "'``>>>``' 還是 '``...``'。" #: ../../library/codeop.rst:25 msgid "" "Remembering which future statements the user has entered, so subsequent " "input can be compiled with these in effect." msgstr "" "記住使用者輸入了哪些未來陳述式,以便後續輸入可以在這些陳述式生效的情況下進行" "編譯。" #: ../../library/codeop.rst:28 msgid "" "The :mod:`codeop` module provides a way of doing each of these things, and a " "way of doing them both." msgstr "" ":mod:`codeop` 模組提供了一種完成上述每項任務的方法,以及同時完成這兩項任務的" "方法。" #: ../../library/codeop.rst:31 msgid "To do just the former:" msgstr "只做前者:" #: ../../library/codeop.rst:35 msgid "" "Tries to compile *source*, which should be a string of Python code and " "return a code object if *source* is valid Python code. In that case, the " "filename attribute of the code object will be *filename*, which defaults to " "``''``. Returns ``None`` if *source* is *not* valid Python code, but " "is a prefix of valid Python code." msgstr "" "嘗試編譯 *source*,它應該是 Python 程式碼的字串,如果 *source* 是有效的 " "Python 程式碼,則回傳一個程式碼物件 (code object)。在這種情況下,程式碼物件的" "檔案名稱屬性將為 *filename*,預設為 ``''``。如果 *source* 不是有效的 " "Python 程式碼,而是有效 Python 程式碼的前綴,則回傳 ``None``。" #: ../../library/codeop.rst:41 msgid "" "If there is a problem with *source*, an exception will be raised. :exc:" "`SyntaxError` is raised if there is invalid Python syntax, and :exc:" "`OverflowError` or :exc:`ValueError` if there is an invalid literal." msgstr "" "如果 *source* 有問題,就會引發例外。如果存在無效的 Python 語法則會引發 :exc:" "`SyntaxError`;如果存在無效的文字 (literal),則會引發 :exc:`OverflowError` " "或 :exc:`ValueError`。" #: ../../library/codeop.rst:45 msgid "" "The *symbol* argument determines whether *source* is compiled as a statement " "(``'single'``, the default), as a sequence of :term:`statement` (``'exec'``) " "or as an :term:`expression` (``'eval'``). Any other value will cause :exc:" "`ValueError` to be raised." msgstr "" "*symbol* 引數決定 *source* 是否編譯為陳述式(``'single'``,為預設值)、為\\ :" "term:`陳述式 `\\ 序列 (``'exec'``) 或為\\ :term:`運算式 " "` (``'eval'``)。任何其他值都會導致引發 :exc:`ValueError`。" #: ../../library/codeop.rst:52 msgid "" "It is possible (but not likely) that the parser stops parsing with a " "successful outcome before reaching the end of the source; in this case, " "trailing symbols may be ignored instead of causing an error. For example, a " "backslash followed by two newlines may be followed by arbitrary garbage. " "This will be fixed once the API for the parser is better." msgstr "" "剖析器 (parser) 有可能(但通常不會)在到達原始碼的結尾之前停止剖析並獲得成功" "的結果;在這種情況下,尾隨符號可能會被忽略而不是導致錯誤。例如,反斜線後面加" "上兩個換行符號後可以是任意的無意義符號。這個問題在未來會因為剖析器 API 的改善" "而被解決。" #: ../../library/codeop.rst:61 msgid "" "Instances of this class have :meth:`~object.__call__` methods identical in " "signature to the built-in function :func:`compile`, but with the difference " "that if the instance compiles program text containing a :mod:`__future__` " "statement, the instance 'remembers' and compiles all subsequent program " "texts with the statement in force." msgstr "" "此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" "`compile` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程式文本," "實例會「記住」並使用該陳述式開始編譯所有後續程式文本。" #: ../../library/codeop.rst:70 msgid "" "Instances of this class have :meth:`~object.__call__` methods identical in " "signature to :func:`compile_command`; the difference is that if the instance " "compiles program text containing a :mod:`__future__` statement, the instance " "'remembers' and compiles all subsequent program texts with the statement in " "force." msgstr "" "此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" "`compile_command` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程" "式文本,實例會「記住」並使用該陳述式開始編譯所有後續程式文本。"