aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mammoth/docx/document_xml.py3
-rw-r--r--mammoth/lists.py11
2 files changed, 13 insertions, 1 deletions
diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py
index f8fb962..8e8dda8 100644
--- a/mammoth/docx/document_xml.py
+++ b/mammoth/docx/document_xml.py
@@ -1,5 +1,6 @@
from .. import documents
from .. import results
+from .. import lists
from .xmlparser import node_types
@@ -105,7 +106,7 @@ def _create_reader(numbering):
def _read_xml_elements(elements):
return results.combine(map(read, elements)) \
- .map(lambda values: filter(None, values))
+ .map(lambda values: lists.filter(None, values))
return read
diff --git a/mammoth/lists.py b/mammoth/lists.py
new file mode 100644
index 0000000..24fa7c4
--- /dev/null
+++ b/mammoth/lists.py
@@ -0,0 +1,11 @@
+import sys
+
+
+__all__ = ["filter"]
+
+if sys.version_info[0] == 2:
+ filter = filter
+else:
+ import builtins
+ def filter(*args, **kwargs):
+ return list(builtins.filter(*args, **kwargs))