X-Git-Url: https://git.korewanetadesu.com/?p=python-collate.git;a=blobdiff_plain;f=collate%2F_abcollator.py;fp=collate%2F_abcollator.py;h=9dce32bee99f5a7d9b746310fa7b3e4a90281af7;hp=0ae5d451f59defb65cb34fb4a2ca6b2f36152212;hb=f1717db91d1ab7b37937cbe5ab17965cb8b7b592;hpb=91fd1e4a0bb531462bc443c21001376411ff862d diff --git a/collate/_abcollator.py b/collate/_abcollator.py index 0ae5d45..9dce32b 100644 --- a/collate/_abcollator.py +++ b/collate/_abcollator.py @@ -18,15 +18,11 @@ class Collator(object): instance according to the 'encoding' attribute of the Collator. """ - keys = [] if isinstance(string, str): string = string.decode(self.encoding, 'replace') - for sorteme in collate.strings.sortemes(string): - num, alpha = collate.strings.numeric(sorteme, invalid) - if num == invalid: - keys.append(self.key(alpha)) - else: - keys.append(num) + # Shove the sortkeyed original string on the end to resolve # ties intelligently. - return (keys, self.key(string)) + return (collate.strings.sortemes(string, self.key), + self.key(string)) +