Execution speed question

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Jul 28 10:11:12 EDT 2008


On Mon, 28 Jul 2008 15:04:43 +0200, Suresh Pillai wrote:

> I could of course use the old trick of using a dictionary with 'None'
> values and then using iterkeys().  But I thought sets were supposed to
> replace this.  So maybe I should be asking a more basic question: is
> there any way to iterate over the items in a set other than converting
> to a list or using the pop() method.

Yes, just do it.

>>> for i in set([1,2,3]):
...     print i
...
1
2
3


-- 
Steven



More information about the Python-list mailing list