Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Zameer
Unindent your first return statement. The return statement in putVar is not needed. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Zameer
Doing cleaup in except is not the Python way. This is what finally is for. Using except you would have to at least say: try: stuff() cleanup() except: cleanup() raise Duplicate code - not nice. finally is the Python way: try: stuff() finally: cleanup() That's it. But the

Re: Best way to handle exceptions with try/finally

2006-05-24 Thread Zameer
> I tend to put "return" > statements at the end of functions to make an attempt at being clean. I > realize that a lot of the time functions will just return but I was > hoping by explicitly stating my function returns that another person > reading my code would more easily see any exit points in

Re: Best way to handle exceptions with try/finally

2006-05-25 Thread Zameer
I wonder where the "else" goes in try..except..finally... -- http://mail.python.org/mailman/listinfo/python-list