@@ -249,24 +249,24 @@ msgstr ""
249249msgid ""
250250"If an exception has arguments, they are printed as the last part ('detail') "
251251"of the message for unhandled exceptions."
252- msgstr ""
252+ msgstr "如果异常有参数,则它们将作为未处理异常的消息的最后一部分('详细信息')打印。 "
253253
254254#: ../../tutorial/errors.rst:219
255255msgid ""
256256"Exception handlers don't just handle exceptions if they occur immediately in"
257257" the try clause, but also if they occur inside functions that are called "
258258"(even indirectly) in the try clause. For example::"
259- msgstr ""
259+ msgstr "异常处理程序不仅处理 try 子句中遇到的异常,还处理 try 子句中调用(即使是间接地)的函数内部发生的异常。例如:: "
260260
261261#: ../../tutorial/errors.rst:237
262262msgid "Raising Exceptions"
263- msgstr ""
263+ msgstr "抛出异常 "
264264
265265#: ../../tutorial/errors.rst:239
266266msgid ""
267267"The :keyword:`raise` statement allows the programmer to force a specified "
268268"exception to occur. For example::"
269- msgstr ""
269+ msgstr ":keyword:`raise` 语句允许程序员强制发生指定的异常。例如:: "
270270
271271#: ../../tutorial/errors.rst:247
272272msgid ""
@@ -276,17 +276,19 @@ msgid ""
276276"will be implicitly instantiated by calling its constructor with no "
277277"arguments::"
278278msgstr ""
279+ ":keyword:`raise` 唯一的参数就是要抛出的异常。这个参数必须是一个异常实例或者是一个异常类(派生自 :class:`Exception` "
280+ "的类)。如果传递的是一个异常类,它将通过调用没有参数的构造函数来隐式实例化::"
279281
280282#: ../../tutorial/errors.rst:254
281283msgid ""
282284"If you need to determine whether an exception was raised but don't intend to"
283285" handle it, a simpler form of the :keyword:`raise` statement allows you to "
284286"re-raise the exception::"
285- msgstr ""
287+ msgstr "如果你需要确定是否引发了异常但不打算处理它,则可以使用更简单的 :keyword:`raise` 语句形式重新引发异常 :: "
286288
287289#: ../../tutorial/errors.rst:273
288290msgid "User-defined Exceptions"
289- msgstr ""
291+ msgstr "用户自定义异常 "
290292
291293#: ../../tutorial/errors.rst:275
292294msgid ""
@@ -295,6 +297,8 @@ msgid ""
295297"typically be derived from the :exc:`Exception` class, either directly or "
296298"indirectly."
297299msgstr ""
300+ "程序可以通过创建新的异常类来命名它们自己的异常(有关Python 类的更多信息,请参阅 :ref:`tut-"
301+ "classes`)。异常通常应该直接或间接地从 :exc:`Exception` 类派生。"
298302
299303#: ../../tutorial/errors.rst:279
300304msgid ""
@@ -306,30 +310,31 @@ msgid ""
306310"module, and subclass that to create specific exception classes for different"
307311" error conditions::"
308312msgstr ""
313+ "可以定义异常类,它可以执行任何其他类可以执行的任何操作,但通常保持简单,通常只提供许多属性,这些属性允许处理程序为异常提取有关错误的信息。在创建可能引发多个不同错误的模块时,通常的做法是为该模块定义的异常创建基类,并为不同错误条件创建特定异常类的子类::"
309314
310315#: ../../tutorial/errors.rst:317
311316msgid ""
312317"Most exceptions are defined with names that end in \" Error\" , similar to the"
313318" naming of the standard exceptions."
314- msgstr ""
319+ msgstr "大多数异常都定义为名称以“错误”结尾,类似于标准异常的命名。 "
315320
316321#: ../../tutorial/errors.rst:320
317322msgid ""
318323"Many standard modules define their own exceptions to report errors that may "
319324"occur in functions they define. More information on classes is presented in"
320325" chapter :ref:`tut-classes`."
321- msgstr ""
326+ msgstr "许多标准模块定义了它们自己的异常,以报告它们定义的函数中可能出现的错误。有关类的更多信息,请参见类 :ref:`tut-classes`。 "
322327
323328#: ../../tutorial/errors.rst:328
324329msgid "Defining Clean-up Actions"
325- msgstr ""
330+ msgstr "定义清理操作 "
326331
327332#: ../../tutorial/errors.rst:330
328333msgid ""
329334"The :keyword:`try` statement has another optional clause which is intended "
330335"to define clean-up actions that must be executed under all circumstances. "
331336"For example::"
332- msgstr ""
337+ msgstr ":keyword:`try` 语句有另一个可选子句,用于定义必须在所有情况下执行的清理操作。例如:: "
333338
334339#: ../../tutorial/errors.rst:344
335340msgid ""
0 commit comments