[lxml-dev] 2.0 ElementTree 1.3 compat: getiterator
Stefan Behnel
stefan_ml at behnel.de
Wed Oct 24 15:25:27 CEST 2007
jholg at gmx.de wrote:
> FWIW I just took a quick look at ElementTree 1.3alpha, and:
>
> # compatibility (FIXME: preserve list behaviour too? see below)
> getiterator = iter
>
> getiterator() is (currently) an iterator (generator), just as it was in lxml pre-2.0. I remember some discussion on this list with regard to that.
According to Fredrik's SVN, he hasn't been working on ET 1.3 since our last
discussion.
The idea was that getiterator() returned a list in older ET versions, while
the docs said something like "returns an iterable: either an iterator or a
list". lxml always returned an iterator here.
Since we now have iter() in place, Fredrik suggested that reverting
getiterator() to the original behaviour would be the cleanest solution. I
actually agree with that, but I am still waiting for Fredrik to actually make
that change official.
> I for one think it counter-intuitive for getiterator() to return a list, so
> I think lxml got that right in the first place.
I would agree from the point of view of the method name, but disagree for
reasons of API redundancy and backwards compatibility.
Stefan
More information about the lxml-dev
mailing list