Skip to content

Commit 87a047d

Browse files
authored
Merge pull request #485 from python-pitfalls/master
removed a case of the default mutable argument pitfall
2 parents 9542dc0 + 3c0a50f commit 87a047d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

requests_html.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,14 @@ def __init__(self, *, session: Union['HTMLSession', 'AsyncHTMLSession'] = None,
431431
def __repr__(self) -> str:
432432
return f"<HTML url={self.url!r}>"
433433

434-
def next(self, fetch: bool = False, next_symbol: _NextSymbol = DEFAULT_NEXT_SYMBOL) -> _Next:
434+
def next(self, fetch: bool = False, next_symbol: _NextSymbol = None) -> _Next:
435435
"""Attempts to find the next page, if there is one. If ``fetch``
436436
is ``True`` (default), returns :class:`HTML <HTML>` object of
437437
next page. If ``fetch`` is ``False``, simply returns the next URL.
438438
439439
"""
440+
if next_symbol is None:
441+
next_symbol = DEFAULT_NEXT_SYMBOL
440442

441443
def get_next():
442444
candidates = self.find('a', containing=next_symbol)

0 commit comments

Comments
 (0)