Revision: 6789 Author: nicdumz Date: 2009-05-02 15:48:06 +0000 (Sat, 02 May 2009)
Log Message: ----------- Using float/int/bool instead of type(1.0)/type(1)/type(False), is instead of ==
Modified Paths: -------------- trunk/pywikipedia/config.py
Modified: trunk/pywikipedia/config.py =================================================================== --- trunk/pywikipedia/config.py 2009-05-02 14:09:03 UTC (rev 6788) +++ trunk/pywikipedia/config.py 2009-05-02 15:48:06 UTC (rev 6789) @@ -452,22 +452,18 @@ print "WARNING: Skipped '%s': owned by someone else."%_filename
# Test for obsoleted and/or unknown variables. -for _key in globals().keys(): - if _key[0]=='_': +for _key, _val in globals().items(): + if _key.startswith('_'): pass elif _key in _gl: - nt=type(globals()[_key]) - ot=_tp[_key] - if nt==ot or nt==type(None) or ot==type(None): + nt = type(_val) + ot = _tp[_key] + if nt == ot or _val is None or ot == type(None): pass - elif nt==type(1) and ot==type(1.0): + elif nt is int and (ot is float or ot is bool): pass - elif ot==type(1) and nt==type(1.0): + elif ot is int and (nt is float or nt is bool): pass - elif nt==type(1) and ot==type(True): - pass - elif ot==type(1) and nt==type(True): - pass else: print "WARNING: Type of '%s' changed"%_key print " Was: ",ot
pywikipedia-svn@lists.wikimedia.org