Python Forum
iterating sets and frozensets - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: iterating sets and frozensets (/thread-22668.html)



iterating sets and frozensets - Skaperen - Nov-22-2019

i have been creating then iterating some large sets. i created them by filling a set with a large sequence of numbers from range() using a comprehension. then i iterate the sets in another comprehension. even for a large size like 8192, the items were iterated in the same order as the original sequence. is this something that should be expected?

i'd like to know if there is a function that can extract a single arbitrary item from a set. would next() be able to do this?

edit:

sorry, my thoughts got mixed up on that. it should be from a frozenset.