Skip to content
This repository was archived by the owner on Dec 17, 2022. It is now read-only.

Commit 81c2519

Browse files
committed
Switch childGenerator to iter(self.contents)
1 parent 8e8d23f commit 81c2519

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

BeautifulSoup.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ def _lastRecursiveChild(self):
173173
return lastChild
174174

175175
def insert(self, position, newChild):
176-
if (isinstance(newChild, basestring)
177-
or isinstance(newChild, unicode)) \
176+
if (isString(newChild)) \
178177
and not isinstance(newChild, NavigableString):
179178
newChild = NavigableString(newChild)
180179

@@ -819,12 +818,8 @@ def _getAttrMap(self):
819818

820819
#Generator methods
821820
def childGenerator(self):
822-
if not len(self.contents):
823-
raise StopIteration
824-
current = self.contents[0]
825-
while current:
826-
yield current
827-
current = current.next
821+
# Just use the iterator from the contents
822+
return iter(self.contents)
828823

829824
def recursiveChildGenerator(self):
830825
if not len(self.contents):

0 commit comments

Comments
 (0)