diff --git a/src/django_bootstrap5/html.py b/src/django_bootstrap5/html.py
index 55b7e969..b4fd30da 100644
--- a/src/django_bootstrap5/html.py
+++ b/src/django_bootstrap5/html.py
@@ -22,7 +22,7 @@ def render_link_tag(url):
def has_prefix(name, prefixes):
"""Return whether the name has one of the given prefixes."""
- return any(name.startswith(f"{prefix}_") for prefix in prefixes)
+ return name.startswith(tuple(f"{prefix}_" for prefix in prefixes))
def hyphenate(attr_name):