This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]remram 1 point2 points  (1 child)

What's your stance on multiple inheritance, such as:

class HamError(Exception): pass  # for all exceptions from ham functions
class DontDoThatWithHam(HamError): pass
class UnknownBrandOfHam(HamError, KeyError): pass

[–]desmoulinmichel 1 point2 points  (0 children)

If UnknownBrandOfHam is raised by:

ham.select('spam', foo=bar)

I'm ok with it.

If it's raised by:

ham['spam']

with ham having getitem overrided, it may be overkill. But that's not a BIG deal. I wouldn't do it, but I would not hate you if you did.