RE: [xml] Question about parent/child (python-libxml2)

On Mon, May 10, 2004 at 05:49:20PM +0200, W. Borgert wrote:
Quoting Daniel Veillard <veillard redhat com>:
fields ??? Obviously the constructor for "for .. in" does
a recursive descent on each element list. So please read

Obviously it was not obvious to me.  I somehow assumed that
the for-loop had the same semantics.

 I think it's all Stéphane Bidoul faults :-), he added support
for iterator at the Python level.

I plead not guilty, your honour :-)
According to the NEWS file (which BTW has some accents
problems on it was not me who implemented
the iterators...

 Since usually people have more trouble walking a tree in document
order than a simple linked list, his choice is probably what helps
Python users most, even if it's not obvious at a syntactic level
that the semantic recurses down the trees.

In python land, that would probably be deemed somewhat unpythonic...
Had I done it myself, I would have made node.children an iterator
for the node's children, and a different method to create a tree
walker iterator.

Anyway, now I suppose it's a documentation issue... ;-)

Have fun.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]