Author zotbar1234
Recipients zotbar1234
Date 2008-03-14.22:19:13
SpamBayes Score 0.478653
Marked as misclassified No
Message-id <1205533155.39.0.576388305845.issue2291@psf.upfronthosting.co.za>
In-reply-to
Content
I have discovered the following behaviour in 2.5, which I cannot explain:

>>> try:
...   raise ValueError("foo")
... except object:
...   print "aiee!"
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ValueError: foo
>>> sys.version
'2.5.1 (r251:54863, Jan 23 2008, 16:53:41) \n[GCC 4.2.2 (Gentoo 4.2.2
p1.0)]'
>>> isinstance(ValueError("foo"), object)
True

At first I thought I misunderstood something about exceptions, but the
wording of the try-statement leads me to believe that this should work.
ValueError is a subclass of object and thus, I think, should be a match,
thus catching the exception.

I realize that all exceptions should inherit from Exception
(BaseException?), but for the sake of consistence, shouldn't "except
object" catch *anything* in python 2.5? I.e. be the equivalent of "except:".

Is this a bug? If so, should this be fixed?
History
Date User Action Args
2008-03-14 22:19:16zotbar1234setspambayes_score: 0.478653 -> 0.478653
recipients: + zotbar1234
2008-03-14 22:19:15zotbar1234setspambayes_score: 0.478653 -> 0.478653
messageid: <1205533155.39.0.576388305845.issue2291@psf.upfronthosting.co.za>
2008-03-14 22:19:14zotbar1234linkissue2291 messages
2008-03-14 22:19:13zotbar1234create