ordered-set icon indicating copy to clipboard operation
ordered-set copied to clipboard

Treat hashables

Open maxfl opened this issue 6 months ago • 0 comments

Any hashable may be added to a set (OrderedSet). Hashables are sometime iterables (tuple, frozenset, string). As soon as OrderedSet.index treats iterables differently compared to the way list works, it should be protected against iterating over hashables. Before, only protection for strings and tuples did exist. In this comment a general approach for any hashable is added. Relevant unit test is added. Documentation is updated.

Also, add slots as slots make it more efficient to access object attributes. It also forbids assigning non-existing attributes, which is consistent with other basic classes, e.g. list, tuple, dict.

maxfl avatar Aug 23 '24 07:08 maxfl