|
From: Andre W. <wo...@us...> - 2005-09-09 13:21:19
|
Hi, On 09.09.05, Michael Schindler wrote: > Is an exception the right thing to use here? I tend to dislike the > try...except notation and am not quite sure how efficient this is. > On the other had, with the different return types "float" or "None" > one always has to ask for the proper return type. Right. And in that sense such an specific exception is fine. And AFAIK (at least as long as exceptions do not occur very often), it is fine to use them. The overhead of the try-block is small (again AFAIK). Beside that one should keep in mind, that exceptions should better not be used to do flow control in a program. I.e. they should not be used as a regular feature when nothing special happens. But to properly work around certain instablilities, which are inherent, an exception seems to be the Right Thing (tm). André -- by _ _ _ Dr. André Wobst / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |