Skip to content

Commit 3335855

Browse files
authored
Replace the 'order' for loop and conditional with a list comprehension (hellt#3)
1 parent 74441db commit 3335855

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fnsort.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ def sort_footnotes(text):
5858
# Determine the order of the footnote-links in the text. If a link is used
5959
# more than once, its order is its first position.
6060
order = []
61-
for i in links:
62-
if order.count(i[1]) == 0:
63-
order.append(i[1])
61+
[order.append(i[1]) for i in links if i[1] not in order]
6462

6563
# print(f"order: {order}")
6664

0 commit comments

Comments
 (0)