From b3c68fad7f8ec6de8bc47145758990a006e36419 Mon Sep 17 00:00:00 2001 From: Lukas Schwab Date: Wed, 18 Oct 2023 18:32:20 -0700 Subject: [PATCH] Default to 100 max_results Defaulting to None yields a bad default user experience: if you provide too open-ended a query (e.g. "testing" or "quantum," examples I use in the docs) and try dumping into `list(...)` rather than using a generator, `max_results=None` with the default `page_size` will appear to hang. In practice, one should *only* set `max_results=None` in a loop that processes results incrementally *or* in a long-running process *or* with a query where the result set is known to be small. This is arguably a breaking change, but I think it may be appropriate to bundle it into a minor-version release. --- arxiv/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arxiv/__init__.py b/arxiv/__init__.py index 1dfc6e1..4339217 100644 --- a/arxiv/__init__.py +++ b/arxiv/__init__.py @@ -438,7 +438,7 @@ def __init__( self, query: str = "", id_list: List[str] = [], - max_results: int | None = None, + max_results: int | None = 100, sort_by: SortCriterion = SortCriterion.Relevance, sort_order: SortOrder = SortOrder.Descending, ):