@@ -188,20 +188,35 @@ msgid ""
188
188
"not in other handlers of the same :keyword:`!try` statement. An except "
189
189
"clause may name multiple exceptions as a parenthesized tuple, for example::"
190
190
msgstr ""
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::"
191
197
192
198
#: ../Doc/tutorial/errors.rst:123
193
199
msgid ""
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 "
197
203
"class). For example, the following code will print B, C, D in that order::"
198
204
msgstr ""
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::"
199
210
200
211
#: ../Doc/tutorial/errors.rst:147
201
212
msgid ""
202
213
"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."
204
216
msgstr ""
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."
205
220
206
221
#: ../Doc/tutorial/errors.rst:150
207
222
msgid ""
@@ -211,6 +226,11 @@ msgid ""
211
226
"message and then re-raise the exception (allowing a caller to handle the "
212
227
"exception as well)::"
213
228
msgstr ""
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)::"
214
234
215
235
#: ../Doc/tutorial/errors.rst:169
216
236
msgid ""
@@ -219,54 +239,80 @@ msgid ""
219
239
"for code that must be executed if the try clause does not raise an "
220
240
"exception. For example::"
221
241
msgstr ""
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::"
222
246
223
247
#: ../Doc/tutorial/errors.rst:183
224
248
msgid ""
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."
229
253
msgstr ""
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`."
230
258
231
259
#: ../Doc/tutorial/errors.rst:188
232
260
msgid ""
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."
236
264
msgstr ""
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."
237
268
238
269
#: ../Doc/tutorial/errors.rst:192
239
270
msgid ""
240
271
"The except clause may specify a variable after the exception name. The "
241
272
"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 "
244
275
"reference ``.args``. One may also instantiate an exception first before "
245
276
"raising it and add any attributes to it as desired. ::"
246
277
msgstr ""
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::"
247
285
248
286
#: ../Doc/tutorial/errors.rst:216
249
287
msgid ""
250
288
"If an exception has arguments, they are printed as the last part ('detail') "
251
289
"of the message for unhandled exceptions."
252
290
msgstr ""
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."
253
293
254
294
#: ../Doc/tutorial/errors.rst:219
255
295
msgid ""
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 "
258
298
"(even indirectly) in the try clause. For example::"
259
299
msgstr ""
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::"
260
304
261
305
#: ../Doc/tutorial/errors.rst:237
262
306
msgid "Raising Exceptions"
263
- msgstr ""
307
+ msgstr "Levantando excepciones "
264
308
265
309
#: ../Doc/tutorial/errors.rst:239
266
310
msgid ""
267
311
"The :keyword:`raise` statement allows the programmer to force a specified "
268
312
"exception to occur. For example::"
269
313
msgstr ""
314
+ "La declaración :keyword:`raise` permite al programador forzar a que ocurra "
315
+ "una excepción específica. Por ejemplo::"
270
316
271
317
#: ../Doc/tutorial/errors.rst:247
272
318
msgid ""
@@ -276,17 +322,25 @@ msgid ""
276
322
"will be implicitly instantiated by calling its constructor with no "
277
323
"arguments::"
278
324
msgstr ""
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::"
279
330
280
331
#: ../Doc/tutorial/errors.rst:254
281
332
msgid ""
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::"
285
336
msgstr ""
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::"
286
340
287
341
#: ../Doc/tutorial/errors.rst:273
288
342
msgid "User-defined Exceptions"
289
- msgstr ""
343
+ msgstr "Excepciones definidas por el usuario "
290
344
291
345
#: ../Doc/tutorial/errors.rst:275
292
346
msgid ""
@@ -295,91 +349,135 @@ msgid ""
295
349
"typically be derived from the :exc:`Exception` class, either directly or "
296
350
"indirectly."
297
351
msgstr ""
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."
298
356
299
357
#: ../Doc/tutorial/errors.rst:279
300
358
msgid ""
301
359
"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::"
309
374
310
375
#: ../Doc/tutorial/errors.rst:317
311
376
msgid ""
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."
314
379
msgstr ""
315
380
316
381
#: ../Doc/tutorial/errors.rst:320
317
382
msgid ""
318
383
"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`."
321
386
msgstr ""
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`."
322
390
323
391
#: ../Doc/tutorial/errors.rst:328
324
392
msgid "Defining Clean-up Actions"
325
- msgstr ""
393
+ msgstr "Definiendo acciones de limpieza "
326
394
327
395
#: ../Doc/tutorial/errors.rst:330
328
396
msgid ""
329
397
"The :keyword:`try` statement has another optional clause which is intended "
330
398
"to define clean-up actions that must be executed under all circumstances. "
331
399
"For example::"
332
400
msgstr ""
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::"
333
404
334
405
#: ../Doc/tutorial/errors.rst:344
335
406
msgid ""
336
407
"A *finally clause* is always executed before leaving the :keyword:`try` "
337
408
"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::"
346
426
347
427
#: ../Doc/tutorial/errors.rst:377
348
428
msgid ""
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."
353
433
msgstr ""
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`."
354
438
355
439
#: ../Doc/tutorial/errors.rst:382
356
440
msgid ""
357
441
"In real world applications, the :keyword:`finally` clause is useful for "
358
442
"releasing external resources (such as files or network connections), "
359
443
"regardless of whether the use of the resource was successful."
360
444
msgstr ""
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."
361
448
362
449
#: ../Doc/tutorial/errors.rst:390
363
450
msgid "Predefined Clean-up Actions"
364
- msgstr ""
451
+ msgstr "Acciones predefinidas de limpieza "
365
452
366
453
#: ../Doc/tutorial/errors.rst:392
367
454
msgid ""
368
455
"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 "
371
458
"to open a file and print its contents to the screen. ::"
372
459
msgstr ""
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.::"
373
465
374
466
#: ../Doc/tutorial/errors.rst:400
375
467
msgid ""
376
468
"The problem with this code is that it leaves the file open for an "
377
469
"indeterminate amount of time after this part of the code has finished "
378
470
"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 "
381
473
"correctly. ::"
382
474
msgstr ""
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.::"
383
481
384
482
#: ../Doc/tutorial/errors.rst:410
385
483
msgid ""
0 commit comments