Nicolas Fleury wrote: > I do a lot of exception re-raising at work; I use that > technique to add content to exception messages while > keeping the original stack. I even created a reraise > function that I use that way: > > try: > parser.parseFile(file) > exeption Exception, exception: > reraise(exception, > "Error at line %s in file %s" % (x,y)) > > (x,y) are details, but you get the idea. > With PEP 344, this could simply be: try: parser.parseFile(file) exeption Exception, exception: raise type(exception)("Error at line %s in file %s" % (x,y)) Introspectively, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com
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