R: [Python-Dev] Deprecating string exceptions (original) (raw)
Martin v. Loewis martin@v.loewis.de
28 Mar 2002 10:37:54 +0100
- Previous message: R: [Python-Dev] Deprecating string exceptions
- Next message: R: [Python-Dev] Deprecating string exceptions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum <guido@python.org> writes:
> >>> class Z(str,Exception): > ... pass
Legal, but not particularly useful. Anyway, I think that "derives from Exception" overrules "derives from str" here, so this should be allowed. Note that currently it creates a new-style class and thus it doesn't work.
What do you mean, it doesn't work?
class Z(str,Exception):pass ... exc = Z("Hallo") try: ... raise exc ... except exc: ... print "Gefangen" ... Gefangen
Regards, Martin
- Previous message: R: [Python-Dev] Deprecating string exceptions
- Next message: R: [Python-Dev] Deprecating string exceptions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]