@@ -188,20 +188,35 @@ msgid ""
188188"not in other handlers of the same :keyword:`!try` statement. An except "
189189"clause may name multiple exceptions as a parenthesized tuple, for example::"
190190msgstr ""
191+ "Una declaración :keyword:`try` puede tener más de un :keyword:`except`, para"
192+ " especificar manejadores para distintas excepciones. A lo sumo un manejador"
193+ " será ejecutado. Sólo se manejan excepciones que ocurren en el "
194+ "correspondiente :keyword:`try`, no en otros manejadores del mismo "
195+ ":keyword:`try`. Un :keyword:`except` puede nombrar múltiples excepciones "
196+ "usando paréntesis, por ejemplo::"
191197
192198#: ../Doc/tutorial/errors.rst:123
193199msgid ""
194- "A class in an :keyword:`except` clause is compatible with an exception if it "
195- "is the same class or a base class thereof (but not the other way around --- "
196- "an except clause listing a derived class is not compatible with a base "
200+ "A class in an :keyword:`except` clause is compatible with an exception if it"
201+ " is the same class or a base class thereof (but not the other way around ---"
202+ " an except clause listing a derived class is not compatible with a base "
197203"class). For example, the following code will print B, C, D in that order::"
198204msgstr ""
205+ "Una clase en una clausula :keyword:`except` es compatible con una excepción "
206+ "si la misma esta en la misma clase o una clase base de la misma (pero no de "
207+ "la otra manera --- una clausula except listando una clase derivada no es "
208+ "compatible con una clase base). Por ejemplo, el siguiente código imprimirá "
209+ "B, C, D, en ese orden::"
199210
200211#: ../Doc/tutorial/errors.rst:147
201212msgid ""
202213"Note that if the except clauses were reversed (with ``except B`` first), it "
203- "would have printed B, B, B --- the first matching except clause is triggered."
214+ "would have printed B, B, B --- the first matching except clause is "
215+ "triggered."
204216msgstr ""
217+ "Notese que si las clausulas de except estuvieran invertidas (con ``except "
218+ "B`` primero), habría impreso B, B, B --- la primera clausula de except "
219+ "coincidente es usada."
205220
206221#: ../Doc/tutorial/errors.rst:150
207222msgid ""
@@ -211,6 +226,11 @@ msgid ""
211226"message and then re-raise the exception (allowing a caller to handle the "
212227"exception as well)::"
213228msgstr ""
229+ "El último :keyword:`except` puede omitir nombrar qué excepción captura, para"
230+ " servir como comodín. Usá esto con extremo cuidado, ya que de esta manera "
231+ "es fácil ocultar un error real de programación. También puede usarse para "
232+ "mostrar un mensaje de error y luego re-generar la excepción (permitiéndole "
233+ "al que llama, manejar también la excepción)::"
214234
215235#: ../Doc/tutorial/errors.rst:169
216236msgid ""
@@ -219,54 +239,80 @@ msgid ""
219239"for code that must be executed if the try clause does not raise an "
220240"exception. For example::"
221241msgstr ""
242+ "Las declaraciones :keyword:`try` ... :keyword:`except` tienen un *bloque "
243+ "else* opcional, el cual, cuando está presente, debe seguir a los except. Es"
244+ " útil para aquel código que debe ejecutarse si el *bloque try* no genera una"
245+ " excepción. Por ejemplo::"
222246
223247#: ../Doc/tutorial/errors.rst:183
224248msgid ""
225- "The use of the :keyword:`!else` clause is better than adding additional code "
226- "to the :keyword:`try` clause because it avoids accidentally catching an "
227- "exception that wasn't raised by the code being protected by the :keyword:`! "
228- "try` ... :keyword:`!except` statement."
249+ "The use of the :keyword:`!else` clause is better than adding additional code"
250+ " to the :keyword:`try` clause because it avoids accidentally catching an "
251+ "exception that wasn't raised by the code being protected by the "
252+ ":keyword:`! try` ... :keyword:`!except` statement."
229253msgstr ""
254+ "El uso de :keyword:`else` es mejor que agregar código adicional en el "
255+ ":keyword:`try` porque evita capturar accidentalmente una excepción que no "
256+ "fue generada por el código que está protegido por la declaración "
257+ ":keyword:`try` ... :keyword:`except`."
230258
231259#: ../Doc/tutorial/errors.rst:188
232260msgid ""
233- "When an exception occurs, it may have an associated value, also known as the "
234- "exception's *argument*. The presence and type of the argument depend on the "
235- "exception type."
261+ "When an exception occurs, it may have an associated value, also known as the"
262+ " exception's *argument*. The presence and type of the argument depend on the"
263+ " exception type."
236264msgstr ""
265+ "Cuando ocurre una excepción, puede tener un valor asociado, también conocido"
266+ " como el *argumento* de la excepción. La presencia y el tipo de argumento "
267+ "depende del tipo de excepción."
237268
238269#: ../Doc/tutorial/errors.rst:192
239270msgid ""
240271"The except clause may specify a variable after the exception name. The "
241272"variable is bound to an exception instance with the arguments stored in "
242- "``instance.args``. For convenience, the exception instance defines :meth: "
243- "`__str__` so the arguments can be printed directly without having to "
273+ "``instance.args``. For convenience, the exception instance defines "
274+ ":meth: `__str__` so the arguments can be printed directly without having to "
244275"reference ``.args``. One may also instantiate an exception first before "
245276"raising it and add any attributes to it as desired. ::"
246277msgstr ""
278+ "El :keyword:`except` puede especificar una variable luego del nombre de "
279+ "excepción. La variable se vincula a una instancia de excepción con los "
280+ "argumentos almacenados en ``instance.args``. Por conveniencia, la instancia"
281+ " de excepción define :meth:`__str__` para que se pueda mostrar los "
282+ "argumentos directamente, sin necesidad de hacer referencia a ``.args``. "
283+ "También se puede instanciar la excepción primero, antes de generarla, y "
284+ "agregarle los atributos que se desee::"
247285
248286#: ../Doc/tutorial/errors.rst:216
249287msgid ""
250288"If an exception has arguments, they are printed as the last part ('detail') "
251289"of the message for unhandled exceptions."
252290msgstr ""
291+ "Si una excepción tiene argumentos, estos se imprimen como la última parte "
292+ "(el 'detalle') del mensaje para las excepciones que no están manejadas."
253293
254294#: ../Doc/tutorial/errors.rst:219
255295msgid ""
256- "Exception handlers don't just handle exceptions if they occur immediately in "
257- "the try clause, but also if they occur inside functions that are called "
296+ "Exception handlers don't just handle exceptions if they occur immediately in"
297+ " the try clause, but also if they occur inside functions that are called "
258298"(even indirectly) in the try clause. For example::"
259299msgstr ""
300+ "Los manejadores de excepciones no manejan solamente las excepciones que "
301+ "ocurren en el *bloque try*, también manejan las excepciones que ocurren "
302+ "dentro de las funciones que se llaman (inclusive indirectamente) dentro del "
303+ "*bloque try*. Por ejemplo::"
260304
261305#: ../Doc/tutorial/errors.rst:237
262306msgid "Raising Exceptions"
263- msgstr ""
307+ msgstr "Levantando excepciones "
264308
265309#: ../Doc/tutorial/errors.rst:239
266310msgid ""
267311"The :keyword:`raise` statement allows the programmer to force a specified "
268312"exception to occur. For example::"
269313msgstr ""
314+ "La declaración :keyword:`raise` permite al programador forzar a que ocurra "
315+ "una excepción específica. Por ejemplo::"
270316
271317#: ../Doc/tutorial/errors.rst:247
272318msgid ""
@@ -276,17 +322,25 @@ msgid ""
276322"will be implicitly instantiated by calling its constructor with no "
277323"arguments::"
278324msgstr ""
325+ "El único argumento a :keyword:`raise` indica la excepción a generarse. Tiene"
326+ " que ser o una instancia de excepción, o una clase de excepción (una clase "
327+ "que hereda de :class:`Exception`). Si se pasa una clase de excepción, la "
328+ "misma sera instanciada implicitamente llamandoa su constructor sin "
329+ "argumentos::"
279330
280331#: ../Doc/tutorial/errors.rst:254
281332msgid ""
282- "If you need to determine whether an exception was raised but don't intend to "
283- "handle it, a simpler form of the :keyword:`raise` statement allows you to re- "
284- "raise the exception::"
333+ "If you need to determine whether an exception was raised but don't intend to"
334+ " handle it, a simpler form of the :keyword:`raise` statement allows you to "
335+ "re- raise the exception::"
285336msgstr ""
337+ "Si necesitás determinar cuando una excepción fue lanzada pero no querés "
338+ "manejarla, una forma simplificada de la instrucción :keyword:`raise` te "
339+ "permite relanzarla::"
286340
287341#: ../Doc/tutorial/errors.rst:273
288342msgid "User-defined Exceptions"
289- msgstr ""
343+ msgstr "Excepciones definidas por el usuario "
290344
291345#: ../Doc/tutorial/errors.rst:275
292346msgid ""
@@ -295,91 +349,135 @@ msgid ""
295349"typically be derived from the :exc:`Exception` class, either directly or "
296350"indirectly."
297351msgstr ""
352+ "Los programas pueden nombrar sus propias excepciones creando una nueva clase"
353+ " excepción (mirá :ref:`tut-classes` para más información sobre las clases de"
354+ " Python). Las excepciones, típicamente, deberán derivar de la clase "
355+ ":exc:`Exception`, directa o indirectamente."
298356
299357#: ../Doc/tutorial/errors.rst:279
300358msgid ""
301359"Exception classes can be defined which do anything any other class can do, "
302- "but are usually kept simple, often only offering a number of attributes that "
303- "allow information about the error to be extracted by handlers for the "
304- "exception. When creating a module that can raise several distinct errors, a "
305- "common practice is to create a base class for exceptions defined by that "
306- "module, and subclass that to create specific exception classes for different "
307- "error conditions::"
308- msgstr ""
360+ "but are usually kept simple, often only offering a number of attributes that"
361+ " allow information about the error to be extracted by handlers for the "
362+ "exception. When creating a module that can raise several distinct errors, a"
363+ " common practice is to create a base class for exceptions defined by that "
364+ "module, and subclass that to create specific exception classes for different"
365+ " error conditions::"
366+ msgstr ""
367+ "Las clases de Excepciones pueden ser definidas de la misma forma que "
368+ "cualquier otra clase, pero usualmente se mantienen simples, a menudo solo "
369+ "ofreciendo un número de atributos con información sobre el error que leerán "
370+ "los manejadores de la excepción. Al crear un módulo que puede lanzar varios"
371+ " errores distintos, una práctica común es crear una clase base para "
372+ "excepciones definidas en ese módulo y extenderla para crear clases "
373+ "excepciones específicas para distintas condiciones de error::"
309374
310375#: ../Doc/tutorial/errors.rst:317
311376msgid ""
312- "Most exceptions are defined with names that end in \" Error\" , similar to the "
313- "naming of the standard exceptions."
377+ "Most exceptions are defined with names that end in \" Error\" , similar to the"
378+ " naming of the standard exceptions."
314379msgstr ""
315380
316381#: ../Doc/tutorial/errors.rst:320
317382msgid ""
318383"Many standard modules define their own exceptions to report errors that may "
319- "occur in functions they define. More information on classes is presented in "
320- "chapter :ref:`tut-classes`."
384+ "occur in functions they define. More information on classes is presented in"
385+ " chapter :ref:`tut-classes`."
321386msgstr ""
387+ "Muchos módulos estándar definen sus propias excepciones para reportar "
388+ "errores que pueden ocurrir en funciones propias. Se puede encontrar más "
389+ "información sobre clases en el capítulo :ref:`tut-classes`."
322390
323391#: ../Doc/tutorial/errors.rst:328
324392msgid "Defining Clean-up Actions"
325- msgstr ""
393+ msgstr "Definiendo acciones de limpieza "
326394
327395#: ../Doc/tutorial/errors.rst:330
328396msgid ""
329397"The :keyword:`try` statement has another optional clause which is intended "
330398"to define clean-up actions that must be executed under all circumstances. "
331399"For example::"
332400msgstr ""
401+ "La declaración :keyword:`try` tiene otra cláusula opcional que intenta "
402+ "definir acciones de limpieza que deben ser ejecutadas bajo ciertas "
403+ "circunstancias. Por ejemplo::"
333404
334405#: ../Doc/tutorial/errors.rst:344
335406msgid ""
336407"A *finally clause* is always executed before leaving the :keyword:`try` "
337408"statement, whether an exception has occurred or not. When an exception has "
338- "occurred in the :keyword:`!try` clause and has not been handled by an :"
339- "keyword:`except` clause (or it has occurred in an :keyword:`!except` or :"
340- "keyword:`!else` clause), it is re-raised after the :keyword:`finally` clause "
341- "has been executed. The :keyword:`!finally` clause is also executed \" on the "
342- "way out\" when any other clause of the :keyword:`!try` statement is left via "
343- "a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement. A "
344- "more complicated example::"
345- msgstr ""
409+ "occurred in the :keyword:`!try` clause and has not been handled by an "
410+ ":keyword:`except` clause (or it has occurred in an :keyword:`!except` or "
411+ ":keyword:`!else` clause), it is re-raised after the :keyword:`finally` "
412+ "clause has been executed. The :keyword:`!finally` clause is also executed "
413+ "\" on the way out\" when any other clause of the :keyword:`!try` statement is"
414+ " left via a :keyword:`break`, :keyword:`continue` or :keyword:`return` "
415+ "statement. A more complicated example::"
416+ msgstr ""
417+ "Una *cláusula finally* siempre es ejecutada antes de salir de la declaración"
418+ " :keyword:`try`, ya sea que una excepción haya ocurrido o no. Cuando ocurre"
419+ " una excepción en la cláusula :keyword:`try` y no fue manejada por una "
420+ "cláusula :keyword:`except` (o ocurrió en una cláusula :keyword:`except` o "
421+ ":keyword:`else`), es relanzada luego de que se ejecuta la cláusula "
422+ ":keyword:`finally`. El :keyword:`finally` es también ejecutado \" a la "
423+ "salida\" cuando cualquier otra cláusula de la declaración :keyword:`try` es "
424+ "dejada via :keyword:`break`, :keyword:`continue` or :keyword:`return`. Un "
425+ "ejemplo más complicado::"
346426
347427#: ../Doc/tutorial/errors.rst:377
348428msgid ""
349- "As you can see, the :keyword:`finally` clause is executed in any event. "
350- "The :exc:`TypeError` raised by dividing two strings is not handled by the : "
351- "keyword:`except` clause and therefore re-raised after the :keyword:`! "
352- "finally` clause has been executed."
429+ "As you can see, the :keyword:`finally` clause is executed in any event. The "
430+ " :exc:`TypeError` raised by dividing two strings is not handled by the "
431+ ": keyword:`except` clause and therefore re-raised after the "
432+ ":keyword:`! finally` clause has been executed."
353433msgstr ""
434+ "Como podés ver, la cláusula :keyword:`finally` es ejecutada siempre. La "
435+ "excepción :exc:`TypeError` lanzada al dividir dos cadenas de texto no es "
436+ "manejado por la cláusula :keyword:`except` y por lo tanto es relanzada luego"
437+ " de que se ejecuta la cláusula :keyword:`finally`."
354438
355439#: ../Doc/tutorial/errors.rst:382
356440msgid ""
357441"In real world applications, the :keyword:`finally` clause is useful for "
358442"releasing external resources (such as files or network connections), "
359443"regardless of whether the use of the resource was successful."
360444msgstr ""
445+ "En aplicaciones reales, la cláusula :keyword:`finally` es útil para liberar "
446+ "recursos externos (como archivos o conexiones de red), sin importar si el "
447+ "uso del recurso fue exitoso."
361448
362449#: ../Doc/tutorial/errors.rst:390
363450msgid "Predefined Clean-up Actions"
364- msgstr ""
451+ msgstr "Acciones predefinidas de limpieza "
365452
366453#: ../Doc/tutorial/errors.rst:392
367454msgid ""
368455"Some objects define standard clean-up actions to be undertaken when the "
369- "object is no longer needed, regardless of whether or not the operation using "
370- "the object succeeded or failed. Look at the following example, which tries "
456+ "object is no longer needed, regardless of whether or not the operation using"
457+ " the object succeeded or failed. Look at the following example, which tries "
371458"to open a file and print its contents to the screen. ::"
372459msgstr ""
460+ "Algunos objetos definen acciones de limpieza estándar que llevar a cabo "
461+ "cuando el objeto no es más necesitado, independientemente de que las "
462+ "operaciones sobre el objeto hayan sido exitosas o no. Mirá el siguiente "
463+ "ejemplo, que intenta abrir un archivo e imprimir su contenido en la "
464+ "pantalla.::"
373465
374466#: ../Doc/tutorial/errors.rst:400
375467msgid ""
376468"The problem with this code is that it leaves the file open for an "
377469"indeterminate amount of time after this part of the code has finished "
378470"executing. This is not an issue in simple scripts, but can be a problem for "
379- "larger applications. The :keyword:`with` statement allows objects like files "
380- "to be used in a way that ensures they are always cleaned up promptly and "
471+ "larger applications. The :keyword:`with` statement allows objects like files"
472+ " to be used in a way that ensures they are always cleaned up promptly and "
381473"correctly. ::"
382474msgstr ""
475+ "El problema con este código es que deja el archivo abierto por un periodo de"
476+ " tiempo indeterminado luego de que esta parte termine de ejecutarse. Esto "
477+ "no es un problema en scripts simples, pero puede ser un problema en "
478+ "aplicaciones más grandes. La declaración :keyword:`with` permite que "
479+ "objetos como archivos sean usados de una forma que asegure que siempre se "
480+ "los libera rápido y en forma correcta.::"
383481
384482#: ../Doc/tutorial/errors.rst:410
385483msgid ""
0 commit comments