Guido writes: > It would be simple enough to introduce new-style exceptions if > Exception were made a new-style class and at the same time all > new-style exceptions were required to derive from Exception: > > raise x > > would check whether x was: > > - a string (but not an instance of a true subclass of str) > - a classic class > - an instance of a classic class > - Exception or a subclass thereof > - an instance of Exception or of a subclass thereof > > Where the first three cases are for backward compatibility. > > Similarly, the rule for > > raise x, y > > should allows x to be > > - a string > - a classic class > - Exception or a subclass thereof > > and in the last two cases, y could either be an instance of x (or of a > subclass of x!), or an argument for x, or a tuple of arguments for x. Okay, after hearing this (plus all the arguments about PEP 317 requiring an excessive level of migration pain), I am now convinced. If the PEP winds up being officially rejected, I propose that it grow a "rejection reasons" section explaing why, and that this section also describe the above plan as the "plausible alternative" to PEP 317 for eventual migration to new-style exceptions. -- Michael Chermside
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