Python Forum

Full Version: iterating sets and frozensets
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.