Hi Brock, Kind of you to be our substitute language nurse. ;) On Thu, Jun 25, 2009 at 02:31:54AM -0700, Brock Pytlik wrote: > [email protected] wrote: >>> src/modules/client/image.py: >>> line 1228: question, what is the difference between 'raise' and >>> 'raise e'; i've seen both forms used >>> >> >> I'm not sure it matters -- we'd have to ask Danek. I put this in here >> while trying to debug where one of my InvalidDepotResponse exceptions >> had gone. I reasoned that since we had the exception assigned to e in >> the except block, perhaps we should raise it by explicitly naming e. >> >> > I know I'm not Danek, but I'm pretty sure it does make a difference. > "raise" causes the original exception to have the same traceback as if > the except block has never happened. "raise e" raises e again, so the > traceback is based at the raise e line. > Simple test case demonstrating the difference: > try: > raise RuntimeError("foo") > except e: > <fill> > If <fill> is filled with "raise", you get that exception came from line > 2, with "raise e", line 4. >> >>> src/modules/server/catalog.py: >>> lines 377-385: is this override actually needed? I thought >>> __init__ got inherited >>> >> >> I thought that the parent class's __init__ method wasn't called by >> default, making it necessary to do this. Perhaps Danek can clarify? >> >> > It's not needed, otherwise the exception classes (and client-query > classes) which simply do "pass" wouldn't work. If you write an init > method, it becomes your job to call the parent's __init__ method.
Thanks for clarifying both of these points. I'll switch back to using raise instead of raise e, and will strike the __init__ method for that class. -j _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
