jenkins-bot submitted this change.
[IMPR] use a sentinel variable to determine the end of an iterable
This enables None to be part of the iterables chain
Change-Id: I76e770735fc1e92fa5cd448751d3da645123760a
---
M pywikibot/tools/__init__.py
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index f81ee0b..52b40ff 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1029,9 +1029,11 @@
:return: the combined generator of iterables
:rtype: generator
"""
+ sentinel = object()
return (item
- for item in itertools.chain.from_iterable(zip_longest(*iterables))
- if item is not None)
+ for item in itertools.chain.from_iterable(
+ zip_longest(*iterables, fillvalue=sentinel))
+ if item is not sentinel)
def filter_unique(iterable, container=None, key=None, add=None):
To view, visit change 700439. To unsubscribe, or for help writing mail filters, visit settings.