Question on try/except

Dan bounces at foo.org
Mon Aug 7 23:41:53 EDT 2006


While perusing sre.py in the standard library, I came upon this snippet 
of code in the _compile() function definition:

     try:
         p = sre_compile.compile(pattern, flags)
     except error, v:
         raise error, v # invalid expression

Is there some particular use in catching an exception and immediately 
re-raising it?  Why catch it at all?

/Dan

-- 
dedded att verizon dott net



More information about the Python-list mailing list