[Python-checkins] r81342 - in python/branches/release26-maint: Doc/includes/minidom-example.py Doc/library/xml.dom.minidom.rst Doc/library/zlib.rst

georg.brandl python-checkins at python.org
Wed May 19 16:16:14 CEST 2010


Author: georg.brandl
Date: Wed May 19 16:16:14 2010
New Revision: 81342

Log:
Merged revisions 78559,78561-78562 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78559 | andrew.kuchling | 2010-03-01 20:45:21 +0100 (Mo, 01 Mär 2010) | 1 line
  
  #7637: update discussion of minidom.unlink() and garbage collection
........
  r78561 | andrew.kuchling | 2010-03-01 20:51:43 +0100 (Mo, 01 Mär 2010) | 1 line
  
  #7191: describe more details of wbits parameter
........
  r78562 | andrew.kuchling | 2010-03-01 21:11:57 +0100 (Mo, 01 Mär 2010) | 1 line
  
  #7637: avoid repeated-concatenation antipattern in example
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Doc/includes/minidom-example.py
   python/branches/release26-maint/Doc/library/xml.dom.minidom.rst
   python/branches/release26-maint/Doc/library/zlib.rst

Modified: python/branches/release26-maint/Doc/includes/minidom-example.py
==============================================================================
--- python/branches/release26-maint/Doc/includes/minidom-example.py	(original)
+++ python/branches/release26-maint/Doc/includes/minidom-example.py	Wed May 19 16:16:14 2010
@@ -19,11 +19,11 @@
 dom = xml.dom.minidom.parseString(document)
 
 def getText(nodelist):
-    rc = ""
+    rc = []
     for node in nodelist:
         if node.nodeType == node.TEXT_NODE:
-            rc = rc + node.data
-    return rc
+            rc.append(node.data)
+    return ''.join(rc)
 
 def handleSlideshow(slideshow):
     print "<html>"

Modified: python/branches/release26-maint/Doc/library/xml.dom.minidom.rst
==============================================================================
--- python/branches/release26-maint/Doc/library/xml.dom.minidom.rst	(original)
+++ python/branches/release26-maint/Doc/library/xml.dom.minidom.rst	Wed May 19 16:16:14 2010
@@ -85,22 +85,12 @@
    dom3 = parseString("<myxml>Some data</myxml>")
    assert dom3.documentElement.tagName == "myxml"
 
-When you are finished with a DOM, you should clean it up.  This is necessary
-because some versions of Python do not support garbage collection of objects
-that refer to each other in a cycle.  Until this restriction is removed from all
-versions of Python, it is safest to write your code as if cycles would not be
-cleaned up.
-
-The way to clean up a DOM is to call its :meth:`unlink` method::
-
-   dom1.unlink()
-   dom2.unlink()
-   dom3.unlink()
-
-:meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific extension to the DOM API.
-After calling :meth:`unlink` on a node, the node and its descendants are
-essentially useless.
-
+When you are finished with a DOM tree, you may optionally call the
+:meth:`unlink` method to encourage early cleanup of the now-unneeded
+objects.  :meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific
+extension to the DOM API that renders the node and its descendants are
+essentially useless.  Otherwise, Python's garbage collector will
+eventually take care of the objects in the tree.
 
 .. seealso::
 

Modified: python/branches/release26-maint/Doc/library/zlib.rst
==============================================================================
--- python/branches/release26-maint/Doc/library/zlib.rst	(original)
+++ python/branches/release26-maint/Doc/library/zlib.rst	Wed May 19 16:16:14 2010
@@ -115,14 +115,18 @@
 
    Decompresses the data in *string*, returning a string containing the
    uncompressed data.  The *wbits* parameter controls the size of the window
-   buffer.  If *bufsize* is given, it is used as the initial size of the output
+   buffer, and is discussed further below.
+   If *bufsize* is given, it is used as the initial size of the output
    buffer.  Raises the :exc:`error` exception if any error occurs.
 
    The absolute value of *wbits* is the base two logarithm of the size of the
    history buffer (the "window size") used when compressing data.  Its absolute
    value should be between 8 and 15 for the most recent versions of the zlib
    library, larger values resulting in better compression at the expense of greater
-   memory usage.  The default value is 15.  When *wbits* is negative, the standard
+   memory usage.  When decompressing a stream, *wbits* must not be smaller
+   than the size originally used to compress the stream; using a too-small
+   value will result in an exception. The default value is therefore the
+   highest value, 15.  When *wbits* is negative, the standard
    :program:`gzip` header is suppressed.
 
    *bufsize* is the initial size of the buffer used to hold decompressed data.  If


More information about the Python-checkins mailing list