]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[].index() raises ValueError if the value is not in the list, so only
authorFred Drake <fdrake@acm.org>
Fri, 11 May 2001 19:44:55 +0000 (19:44 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 11 May 2001 19:44:55 +0000 (19:44 +0000)
catch that instead of using a bare except clause.

Demo/tix/tixwidgets.py

index b2873648d8c028d93547720acad5165af6a26806..556d3b7797b1524904cf18f1498f7c9992e2b5c7 100644 (file)
@@ -294,7 +294,7 @@ def spin_validate(w):
 
     try:
        i = states.index(demo_spintxt.get())
-    except:
+    except ValueError:
        return states[0]
     return states[i]
     # why this procedure works as opposed to the previous one beats me.