tighten up except - in this context, AttributeError is the only exception

that can be raised - do_help won't be called if arg is not a string
This commit is contained in:
Skip Montanaro 2002-03-24 16:34:21 +00:00
parent ccbb0edf0e
commit 1ce0073a4e
1 changed files with 2 additions and 2 deletions

View File

@ -214,13 +214,13 @@ class Cmd:
# XXX check arg syntax
try:
func = getattr(self, 'help_' + arg)
except:
except AttributeError:
try:
doc=getattr(self, 'do_' + arg).__doc__
if doc:
print doc
return
except:
except AttributeError:
pass
print self.nohelp % (arg,)
return