summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2013-05-08 12:30:32 -0400
committerLeonard Richardson <leonardr@segfault.org>2013-05-08 12:30:32 -0400
commitdd5661fab6c7b8ae352d58a411d3dcf1aaeaa45d (patch)
tree9b8bf876cfcc0561f60486dca594ed996153f4ca /bs4/element.py
parent98e695a43fe54a6956f2214908dbea8947bf694c (diff)
Minor cleanup.
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py
index e7f4af9..21e040a 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -1264,6 +1264,8 @@ class Tag(PageElement):
if self.count == self.destination:
return True
if self.count > self.destination:
+ # Stop the generator that's sending us
+ # these things.
raise StopIteration()
return False
checker = Counter(pseudo_value).nth_child_of_type
@@ -1360,6 +1362,8 @@ class Tag(PageElement):
try:
result = checker(candidate)
except StopIteration:
+ # The checker has decided we should no longer
+ # run the generator.
break
if checker is None or result:
if self._select_debug: