[Biopython] Making TranslationError subclass ValueError

Peter Cock p.j.a.cock at googlemail.com
Mon Mar 4 13:19:39 UTC 2013


Hello all,

Kai and were talking on Twitter, we agreed that when writing
generic error handling, it might be nice if TranslationError
(defined in Bio.Data.CodonTable and raised when during
sequence translation) was a subclass of ValueError - rather
than the generic Exception.

The idea would be something like this:

from Bio.Data.CodonTable import TranslationError
try:
    some_biopython_code(arguments)
except (TranslationError, ValueError):
    #Do XXX

Could be just:

try:
    some_biopython_code(arguments)
except ValueError: #Includes TranslationError
    #Do XXX

Any thoughts? Good idea? Bad idea?

Peter



More information about the Biopython mailing list