diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2013-10-28 12:07:15 +0100 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2013-10-28 12:07:15 +0100 |
commit | 0ba7aa7ab5153e6a490425dd0f859cc5947360f4 (patch) | |
tree | 79d8376a95c92825c0aca0b724a0e0bffb41b29a /Lib/fontTools/ttLib/tables/_n_a_m_e.py | |
parent | d95db25720eff340230e33971f95de846d2ef96c (diff) | |
download | fonttools-0ba7aa7ab5153e6a490425dd0f859cc5947360f4.tar.gz |
Make __cmp__() functions stable
Diffstat (limited to 'Lib/fontTools/ttLib/tables/_n_a_m_e.py')
-rw-r--r-- | Lib/fontTools/ttLib/tables/_n_a_m_e.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/fontTools/ttLib/tables/_n_a_m_e.py b/Lib/fontTools/ttLib/tables/_n_a_m_e.py index 307fbb54..22709839 100644 --- a/Lib/fontTools/ttLib/tables/_n_a_m_e.py +++ b/Lib/fontTools/ttLib/tables/_n_a_m_e.py @@ -89,9 +89,8 @@ class table__n_a_m_e(DefaultTable.DefaultTable): return None # not found def __cmp__(self, other): - if type(self) != type(other) or \ - self.__class__ != other.__class__: - return cmp(id(self), id(other)) + if type(self) != type(other): return cmp(type(self), type(other)) + if self.__class__ != other.__class__: return cmp(self.__class__, other.__class__) return cmp(self.names, other.names) @@ -139,9 +138,8 @@ class NameRecord: """Compare method, so a list of NameRecords can be sorted according to the spec by just sorting it...""" - if type(self) != type(other) or \ - self.__class__ != other.__class__: - return cmp(id(self), id(other)) + if type(self) != type(other): return cmp(type(self), type(other)) + if self.__class__ != other.__class__: return cmp(self.__class__, other.__class__) selftuple = (self.platformID, self.platEncID, |