[PyKDE] Iterators / generators for QList(Box, View) and other?

Phil Thompson phil at river-bank.demon.co.uk
Wed Apr 2 17:29:00 BST 2003


On Wednesday 02 April 2003 2:40 pm, Torsten Marek wrote:
> Hello there,
>
> I just wanted to ask if some version of PyQt will support iterators for
> Listboxes, Listviews etc. through generator functions or the __iter__
> protocol? I know both are Python 2.2+ specific, but are there any plans
> to implement them, Phil? Is anybody of you interested in having them? A
> simple iterator for a QListBox using generators would look like this
> (works only with Python 2.2 or greater):
>
>
>
> from __future__ import generators 	# python2.2 only
>
> def ListBoxIterator(listbox):
> 	item = listbox.firstItem()
> 	while item:
> 		yield item
> 		item = item.next()
> 	return 				# no special need to do this
>
> Don't know about generators yet? Read
> http://www.python.org/doc/2.3a2/whatsnew/section-generators.html
> to get a fast intro.

See the SIP Roadmap.

Phil




More information about the PyQt mailing list