diff options
| author | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2010-06-09 08:13:42 +0000 |
|---|---|---|
| committer | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2010-06-09 08:13:42 +0000 |
| commit | 17173cfe7b5f880c02a8f9468f17607ec84e5b39 (patch) | |
| tree | 51a9e201ac3e86ad153505c8da15b4229f5f39f3 /Doc/library/xml.dom.minidom.rst | |
| parent | 3dcb5acdb0151d1686762329ec07ae2ac4d1caae (diff) | |
| download | cpython-git-17173cfe7b5f880c02a8f9468f17607ec84e5b39.tar.gz | |
http://bugs.python.org/issue8832
Issue minidom.unlink with a context manager
Diffstat (limited to 'Doc/library/xml.dom.minidom.rst')
| -rw-r--r-- | Doc/library/xml.dom.minidom.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst index 5ece1ca13f..792a8dcd59 100644 --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -114,6 +114,13 @@ module documentation. This section lists the differences between the API and to be called on the :class:`Document` object, but may be called on child nodes to discard children of that node. + You can avoid calling this method explicitly by using the :keyword:`with` + statement. The following code will automatically unlink *dom* when the + :keyword:`with` block is exited:: + + with xml.dom.minidom.parse(datasource) as dom: + ... # Work with dom. + .. method:: Node.writexml(writer, indent="", addindent="", newl="", encoding="") |
