def reduce_numbers(self, aList):
'''
Return aList with all number types in aList replaced by the most
general numeric type in aList.
'''
trace = False
found = None
numbers = ('number', 'complex', 'float', 'long', 'int')
for kind in numbers:
for z in aList:
if z == kind:
found = kind
break
if found:
break
if found:
assert found in numbers, found
aList = [z for z in aList if z not in numbers]
aList.append(found)
if trace: g.trace(aList)
return aList
评论列表
文章目录