Skip to content

Commit

Permalink
Replace the 'order' for loop and conditional with a list comprehension (
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbear authored Sep 23, 2024
1 parent 74441db commit 3335855
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fnsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def sort_footnotes(text):
# Determine the order of the footnote-links in the text. If a link is used
# more than once, its order is its first position.
order = []
for i in links:
if order.count(i[1]) == 0:
order.append(i[1])
[order.append(i[1]) for i in links if i[1] not in order]

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

Expand Down

0 comments on commit 3335855

Please sign in to comment.