From 0ec1ed723615b8bc62d8859b85a43e6a4d5379a2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 23 Apr 2024 04:20:20 -0400 Subject: [PATCH] Prefer expression algebra --- inflect/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inflect/__init__.py b/inflect/__init__.py index 28d3e80..f6769b7 100644 --- a/inflect/__init__.py +++ b/inflect/__init__.py @@ -3777,7 +3777,7 @@ def enword(self, num: str, group: int) -> str: @staticmethod def _sub_ord(val): new = ordinal_suff.sub(lambda match: ordinal[match.group(1)], val) - return new if new != val else val + "th" + return new + "th" * (new == val) @typechecked def number_to_words( # noqa: C901