callable() is better way to determine callable than hasattr
authorAlexander Solovyov <piranha@piranha.org.ua>
Sun, 28 Jun 2009 19:53:20 +0300
changeset 25 2854f81bfc8b
parent 24 57009da05d69
child 26 42f2917b59ec
callable() is better way to determine callable than hasattr
fancycmd.py
--- a/fancycmd.py	Sun Jun 28 13:54:42 2009 +0300
+++ b/fancycmd.py	Sun Jun 28 19:53:20 2009 +0300
@@ -208,7 +208,7 @@
         # copy defaults to state
         if isinstance(default, list):
             state[pyname] = default[:]
-        elif hasattr(default, '__call__'):
+        elif callable(default):
             state[pyname] = None
         else:
             state[pyname] = default