[PyKDE] Re: iterating over a QListView

Christopher J. Bottaro cjbottaro at alumni.cs.utexas.edu
Tue Feb 22 21:54:18 GMT 2005

On Tuesday 22 February 2005 3:10 pm, Jim Bublitz wrote:
> On Tuesday 22 February 2005 11:35, Christopher J. Bottaro wrote:
> Forgot to answer this:
> > This question goes for all Qt iterator classes (i.e. are they turned
> > Python iterables by PyQt?).
> QlistViewItemIterator is implemented in PyQt - you'd have to check the
> docs for the others.

Right, but what I meant was does PyQt turn those iterator classes into
"Python iterables".  By that I mean, can they be used in a for loop such

# lv is a QListView
for lvi in QListViewItemIterator(lv):
  # do something with the list view item

The answer is no, btw.  The above code yields a "TypeError: iteration over
non-sequence" exception.

That kinda stinks, it would be nice if it was more Pythonic (while still
adhering to the C++ API of course).

-- C

More information about the PyQt mailing list