A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/021838.html below:

R: [Python-Dev] Deprecating string exceptions

R: [Python-Dev] Deprecating string exceptions R: [Python-Dev] Deprecating string exceptionsMartin v. Loewis martin@v.loewis.de
28 Mar 2002 10:35:36 +0100
barry@zope.com (Barry A. Warsaw) writes:

> Can you explain why you think the rule should be so strict?  I don't
> see a problem with using multiple inheritance to satisfy the "must
> derive" rule.

The question is, whether, given

class Base:pass
class MyExc(Base, Exception):pass

it would be valid to write

try:
  foo() # raises MyExc
except Base:
  pass

If that ought to be allowed, I fail to see the rationale to require
that exceptions be derived from Exception: The rationale could be "all
exceptions are primarily instances of Exception" - yet in this case,
Base is the primary class, and Exception is just a mix-in that plays
no further role in this case of exception handling.

If you want to allow Base in the except clause, but do allow Base as
the base class of MyExc, I'd be curious what run-time semantics you'd
associate with this example.

Regards,
Martin




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4