1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

use key instead of cmp while sorting list

the cmp kwarg of list.sort method is deprecated in py3
This commit is contained in:
Keerthan Jaic 2015-03-17 18:03:42 -04:00
parent 7f500d1ec0
commit efce0a3e4f

View File

@ -275,7 +275,7 @@ def _writeCustomPackage(f, intf):
print("attribute enum_encoding: string;", file=f)
print(file=f)
sortedList = list(_enumPortTypeSet)
sortedList.sort(cmp=lambda a, b: cmp(a._name, b._name))
sortedList.sort(key=lambda x: x._name)
for t in sortedList:
print(" %s" % t._toVHDL(), file=f)
print(file=f)
@ -366,7 +366,7 @@ def _writeConstants(f):
def _writeTypeDefs(f):
f.write("\n")
sortedList = list(_enumTypeSet)
sortedList.sort(cmp=lambda a, b: cmp(a._name, b._name))
sortedList.sort(key=lambda x: x._name)
for t in sortedList:
f.write("%s\n" % t._toVHDL())
f.write("\n")