Merge pull request #485 from python-pitfalls/master

removed a case of the default mutable argument pitfall
This commit is contained in:
surister
2023-02-26 14:20:30 +01:00
committed by GitHub
+3 -1
View File
@@ -431,12 +431,14 @@ class HTML(BaseParser):
def __repr__(self) -> str:
return f"<HTML url={self.url!r}>"
def next(self, fetch: bool = False, next_symbol: _NextSymbol = DEFAULT_NEXT_SYMBOL) -> _Next:
def next(self, fetch: bool = False, next_symbol: _NextSymbol = None) -> _Next:
"""Attempts to find the next page, if there is one. If ``fetch``
is ``True`` (default), returns :class:`HTML <HTML>` object of
next page. If ``fetch`` is ``False``, simply returns the next URL.
"""
if next_symbol is None:
next_symbol = DEFAULT_NEXT_SYMBOL
def get_next():
candidates = self.find('a', containing=next_symbol)