Skip to content

Commit cec4ce5

Browse files
committed
Re-organize for brevity.
1 parent 854780a commit cec4ce5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

distutils/version.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,11 @@ def _cmp(self, other):
185185
elif not isinstance(other, StrictVersion):
186186
return NotImplemented
187187

188-
if self.version != other.version:
189-
# numeric versions don't match
190-
# prerelease stuff doesn't matter
191-
if self.version < other.version:
192-
return -1
193-
else:
194-
return 1
195-
196-
return self._cmp_prerelease(other)
188+
if self.version == other.version:
189+
# versions match; pre-release drives the comparison
190+
return self._cmp_prerelease(other)
191+
192+
return -1 if self.version < other.version else 1
197193

198194
def _cmp_prerelease(self, other):
199195
"""

0 commit comments

Comments
 (0)