From 7f34998dab7eec550ba247c5a621504141c4eb04 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 22 Jun 2019 20:53:28 +0200 Subject: [PATCH] Identity is not the same things as equality in Python --- auto_sort/asort.py | 2 +- auto_sort/asort_es-ES.py | 2 +- auto_sort/asort_zh.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/auto_sort/asort.py b/auto_sort/asort.py index f8e0bcd..f73eaed 100644 --- a/auto_sort/asort.py +++ b/auto_sort/asort.py @@ -54,7 +54,7 @@ def main(): line = line.strip() items.append(line) # When no more items, blank line or new header - elif line is '\n': + elif line == '\n': # when we meet the next header, we should stop adding new item to the list. for item in sorted(items, key=lambda x: regex.findall(x.upper())[len(regex.findall(x.upper()))-1]): # write the ordered list to the temporary file. diff --git a/auto_sort/asort_es-ES.py b/auto_sort/asort_es-ES.py index da6543e..f566375 100644 --- a/auto_sort/asort_es-ES.py +++ b/auto_sort/asort_es-ES.py @@ -54,7 +54,7 @@ def main(): line = line.strip() items.append(line) # When no more items, blank line or new header - elif line is '\n': + elif line == '\n': # when we meet the next header, we should stop adding new item to the list. for item in sorted(items, key=lambda x: regex.findall(x.upper())[len(regex.findall(x.upper()))-1]): # write the ordered list to the temporary file. diff --git a/auto_sort/asort_zh.py b/auto_sort/asort_zh.py index 24f3e39..9e0a72c 100644 --- a/auto_sort/asort_zh.py +++ b/auto_sort/asort_zh.py @@ -54,7 +54,7 @@ def main(): line = line.strip() items.append(line) # When no more items, blank line or new header - elif line is '\n': + elif line == '\n': # when we meet the next header, we should stop adding new item to the list. for item in sorted(items, key=lambda x: regex.findall(x.upper())[len(regex.findall(x.upper()))-1]): # write the ordered list to the temporary file.