1. Lars Yencken
  2. iterxml


Lars Yencken  committed e343c91

Adds an informative docstring.

  • Participants
  • Parent commits 20e27ce
  • Branches default
  • Tags v0.1.0

Comments (0)

Files changed (1)

File iterxml.py

View file
  • Ignore whitespace
 import gzip
 def iterxml(stream_or_file, tag_of_interest):
+    """
+    When passed a stream or filename and a tag of interest, returns an
+    iterator over matching nodes in the stream. If a filename is given with
+    standard gzip or bz2 file extensions, the file is transparently
+    decompressed.
+    The iteration destructively removes node history after each element is
+    parsed, in order to allow parsing of files whose contents are too large
+    to fit into memory.
+    """
     if isinstance(stream_or_file, (str, unicode)):
         if stream_or_file.endswith('.bz2'):
             istream = bz2.BZ2File(stream_or_file, 'r')