From 66c2af1489ec42f4674145f7e5483027af0a84c2 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 24 Mar 2017 22:02:20 +0100 Subject: Use key instead of cmp when sorting lexers. This is considered good practice these days, and also makes the code work with python 3. --- pastepy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pastepy.py b/pastepy.py index 23eb40e..38c7d1a 100644 --- a/pastepy.py +++ b/pastepy.py @@ -55,7 +55,7 @@ class Paste(object): rendered.append(('Rendered markdown', 'md-render')) if len(rendered): self.lexers.append(('Rendered', rendered)) - self.lexers.append(('Others' if settings.categories else 'Syntax', sorted(lexers.items(), cmp = lambda a, b: cmp(a[0], b[0])))) + self.lexers.append(('Others' if settings.categories else 'Syntax', sorted(lexers.items(), key = lambda l: l[0].lower()))) self.formatter = CustomHtmlFormatter(linenos = 'table', lineanchors = 'line', anchorlinenos = True) random.seed() -- cgit v1.2.3