From 35a892134f0c068993ca39894b8e18c08a8fa57d Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Wed, 2 Sep 2026 16:14:55 -0700 Subject: [PATCH] Fix typo in find_newest and improve docstring Updated docstring for clarity and corrected variable usage in sorting. --- py/pytudes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/pytudes.py b/py/pytudes.py index 6acda49..1bc4ff7 100644 --- a/py/pytudes.py +++ b/py/pytudes.py @@ -195,12 +195,12 @@ def format_notebooks() -> str: return '\n'.join(format_category(name) for name in notebooks) def find_newest(notebooks, New='New', year=new_year) -> None: - """Mutate `notebooks['New']` to have a collection of newest notebooks.""" + """Mutate `notebooks[New]` to have a collection of newest notebooks, from `new_year` or later.""" for category in notebooks: for line in notebooks[category]: if line[1] >= year and line not in notebooks[New]: notebooks[New].append(line) - notebooks[label].sort(key=lambda line: (-line[1], line[0])) + notebooks[New].sort(key=lambda line: (-line[1], line[0])) def format_category(category) -> str: """Make a table of multiple jupyter/ipython notebooks, under a header."""