From c0aa6d696681ef3d3e6aecc290612a054ac76b38 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Mon, 27 Mar 2023 10:42:13 -0400 Subject: Updated __copy__ docstrings. --- bs4/element.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bs4/element.py b/bs4/element.py index e75d326..42b4a51 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -966,6 +966,9 @@ class NavigableString(str, PageElement): return type(self)(self) def __copy__(self): + """A copy of a NavigableString can only be a deep copy, because + only one PageElement can occupy a given place in a parse tree. + """ return self.__deepcopy__({}) def __getnewargs__(self): @@ -1341,8 +1344,9 @@ class Tag(PageElement): return clone def __copy__(self): - # A copy of a Tag must always be a deep copy, because the - # Tag's children can only have one parent at a time. + """A copy of a Tag must always be a deep copy, because a Tag's + children can only have one parent at a time. + """ return self.__deepcopy__({}) def _clone(self): -- cgit v1.2.3