I wonder where the "else" goes in try..except..finally...
--
http://mail.python.org/mailman/listinfo/python-list
> 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
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
Unindent your first return statement. The return statement in putVar is
not needed.
--
http://mail.python.org/mailman/listinfo/python-list