Replace hasattr() + getattr() with single getattr() and default value.

This commit is contained in:
Jeremy Hylton 2003-02-06 16:22:01 +00:00
parent 26507dbc82
commit 656d4519b5
1 changed files with 1 additions and 2 deletions

View File

@ -943,8 +943,7 @@ def whichmodule(func, funcname):
if module is None:
continue # skip dummy package entries
if name != '__main__' and \
hasattr(module, funcname) and \
getattr(module, funcname) is func:
getattr(module, funcname, None) is func:
break
else:
name = '__main__'