> I do not want to remove the element, but get some element > from the Set. . . . > Is there a way to do this. I am doing it like this: > > for x in s: break > > Now x is /some_element/ from s.
That is one way to do it. Another is to write: x = iter(s).next() One more approach: x = s.pop() s.add(x) Raymond Hettinger -- http://mail.python.org/mailman/listinfo/python-list