[Lxml-checkins] r46648 - in lxml/trunk: . doc

scoder at codespeak.net scoder at codespeak.net
Sat Sep 15 19:30:58 CEST 2007


Author: scoder
Date: Sat Sep 15 19:30:58 2007
New Revision: 46648

Modified:
   lxml/trunk/CHANGES.txt
   lxml/trunk/doc/tutorial.txt
Log:
getchildren() deprecated

Modified: lxml/trunk/CHANGES.txt
==============================================================================
--- lxml/trunk/CHANGES.txt	(original)
+++ lxml/trunk/CHANGES.txt	Sat Sep 15 19:30:58 2007
@@ -36,6 +36,11 @@
 Other changes
 -------------
 
+* ``element.getchildren()`` deprecated (ElementTree 1.3 compatible behaviour)
+
+* ``element.getiterator()`` returns a list, use ``element.iter()`` to retrieve
+  an iterator (ElementTree 1.3 compatible behaviour)
+
 
 2.0alpha1 (2007-09-02)
 ======================

Modified: lxml/trunk/doc/tutorial.txt
==============================================================================
--- lxml/trunk/doc/tutorial.txt	(original)
+++ lxml/trunk/doc/tutorial.txt	Sat Sep 15 19:30:58 2007
@@ -125,6 +125,8 @@
     >>> print len(root)
     3
 
+    >>> children = list(root)
+
     >>> for child in root:
     ...     print child.tag
     child1
@@ -173,20 +175,6 @@
     >>> print [ c.tag for c in root ]
     ['child3', 'child1', 'child2']
 
-To retrieve a 'real' Python list of all children (or a *shallow copy* of the
-element children list), you can call the ``getchildren()`` method::
-
-    >>> children = root.getchildren()
-
-    >>> print type(children) is type([])
-    True
-
-    >>> for child in children:
-    ...     print child.tag
-    child3
-    child1
-    child2
-
 The way up in the tree is provided through the ``getparent()`` method::
 
     >>> root is root[0].getparent()  # lxml.etree only!


More information about the lxml-checkins mailing list