I was studying Data Structures in python where I read about how we cannot access elements in sets from the index. I researched about it and the main reason I found is that the sets are unordered. Then I found on this website that says we cannot access from the index because sets don't generate hash values, but sets uses hashing as data structure and hashing always creates a hash value when saving in the hash table (correct me if I am wrong).
My main question is why we can't access sets from the index, is it just because of unordered or any other reason? And if it doesn't have hash values how are sets exactly saved?
Edit - Copy paste this link if not the above link doesn't work https://www.python-engineer.com/posts/set-vs-frozentset/#:~:text=Since%20the%20elements%20are%20mutable%20and%20not%20in%20order%2C%20they%20don%E2%80%99t%20have%20hash%20values.%20So%20you%20can%E2%80%99t%20access%20the%20elements%20with%20the%20help%20of%20index%20numbers.
Perhaps you are mixing two different aspects.
Sets are mutable objects, hence unhashable, exactly like lists. Frozensets instead are immutable and hashable, exactly like tuples. So for instance frozensets can be keys of a dictionary, while sets cannot.
Then both sets and frozensets require hashable elements, while lists and tuples don't. And since they store the hash values of their elements they are not indexable, and will not accept duplicate values for their elements.
At a higher level, you may consider that sets (or frozensets) are optimized for certain use cases which do not include indexing or slicing, while the various sequence types (list, tuples, ...) are optimized for those operations.