screwhashesset


Namescrewhashesset JSON
Version 0.12 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/screwhashesset
SummaryA set that handles all kinds of objects (hashable or not) and preserves the order of the elements
upload_time2023-07-08 20:15:44
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords set hash collections
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# A set that handles all kinds of objects (hashable or not) and preserves the order of the elements

## pip install screwhashesset

#### Tested against Windows 10 / Python 3.10 / Anaconda 


The module implements a data structure called "ScrewHashesSet" 
which is a custom set implementation in Python. 
The ScrewHashesSet combines the functionality of a set and a deque 
(double-ended queue) by using a deque to store the elements and a set 
to efficiently perform membership checks.

The ScrewHashesSet provides various methods to manipulate and interact with the set, 
including adding elements, removing elements, checking for membership, 
performing set operations (e.g., union, intersection, difference), and modifying the set in-place.

This module can be useful for developers who need to work with sets and 
require efficient operations for adding, removing, 
and checking membership of elements, while also having the flexibility of 
a deque for efficient element insertion and removal at both ends of the set. 
The ScrewHashesSet can be particularly beneficial in scenarios 
where the order of elements is important, such as maintaining a 
sorted collection or implementing a queue-like data structure.

### Advantages of using ScrewHashesSet:

#### Efficient Membership Checks: 

The underlying set data structure allows for fast membership checks,
providing constant-time complexity O(1) for determining whether an element is in the set.


#### Flexible Element Manipulation: 

The ScrewHashesSet supports various methods for adding, removing, and modifying elements, 
including insertion at specific indices and removing elements from both ends of the set.

#### Compatibility with Mutable Elements:

An advantage of using the ScrewHashesSet module is its compatibility with mutable elements. 
Unlike the built-in set in Python, which only allows immutable objects as elements, 
the ScrewHashesSet module can handle both mutable and immutable objects.

This means that you can use the ScrewHashesSet to store and manipulate objects that can be modified 
after being added to the set. This flexibility is particularly useful when dealing with 
complex data structures or objects that need to be updated or modified while still being part of the set.

By supporting mutable elements, the ScrewHashesSet module provides developers with the ability 
to work with a wider range of data types and structures, allowing for more flexible and dynamic use cases. 
This advantage enhances the practicality and versatility of the module, making 
it suitable for scenarios where mutable objects need to be stored, manipulated, 
and tracked within a set-like data structure.

#### Preserves Element Order:

The ScrewHashesSet utilizes a deque to maintain the order of elements, 
ensuring that the elements are stored and retrieved in the same order they were added.

#### Set Operations: 

The module includes methods for performing common set operations, such as union, 
intersection, difference, and symmetric difference, allowing developers to combine and 
manipulate sets efficiently.

#### Modifiable In-Place:

Many methods of ScrewHashesSet modify the set in-place, providing the advantage of not requiring 
additional memory allocation when modifying the set's contents.




## Import it 

```python
from screwhashesset import ScrewHashesSet as se
```

## Examples with unmutables

```python
l1 = [
    9,
    0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    9,
]
l2 = [12, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13]
l3 = [5, 3, 4, 5]
l4 = [19, 20, 21, 22]
s1 = se(l1)
print(f"{s1=}")
print(f"{len(s1)=}")
print(f"{9 in s1=}")
print(f"{19 in s1=}")
print(f"{9 not in s1=}")
print(f"{19 not in s1=}")
print(f"{s1.isdisjoint(se(l4))=}")
print(f"{s1.isdisjoint(l4)=}")
print(f"{s1.issubset(se(l3))=}")
print(f"{s1 <= se(l3)=}")
print(f"{s1 < se(l3)=}")
print(f"{se(l3).issubset(s1)=}")
print(f"{se(l3) <= s1=}")
print(f"{se(l3) < s1=}")

print(f"{s1.issuperset(se(l3))=}")
print(f"{s1 >=se(l3)=}")
print(f"{s1 >se(l3)=}")

print(f"{se(l3).issuperset(s1)=}")
print(f"{se(l3) >= s1=}")
print(f"{se(l3) > s1=}")


print(f"{s1.union(l1,l2,l3,l4)=}")
print(f"{s1.union(se(l1),se(l2),se(l3),se(l4))=}")
print(f"{s1 | l2 | l3 | l4=}")
print(f"{s1 | tuple(l2) | se(l3) | se(l4)=}")

print(f"{[x**2 for x in s1]=}")


print(f"{s1.intersection(l1,l2,l3)=}")
print(f"{s1.intersection(se(l1),se(l2),se(l3))=}")
print(f"{s1 & l2 & l3=}")
print(f"{s1 & tuple(l2) & se(l3)=}")


print(f"{s1.difference(l2,l3)=}")
print(f"{s1.difference(se(l2),se(l3))=}")
print(f"{s1 - l2 - l3=}")
print(f"{s1 - tuple(l2) - se(l3)=}")

print(f"{s1.symmetric_difference(l2,l3)=}")
print(f"{s1.symmetric_difference(se(l2),se(l3))=}")
print(f"{s1 ^ l2 ^ l3=}")
print(f"{s1 ^ tuple(l2) ^ se(l3)=}")

s6 = s1.copy()
print(f"{s6 is s1=}")
print(f"{s6 == s1=}")

s6.update(l4)
print(f"s6.update(l4)={s6}")
s6.update(se(l2))
print(f"s6.update(se(l2))={s6}")

s7 = s1.copy()
s7 |= l4
print(f"s7 |= l4={s7}")
s7 |= se(l2)
print(f"s7 |= se(l2)={s7}")

s10 = se(l1)
s11 = se(l2)
s12 = se(l3)
s13 = se(l4)
s10.intersection_update(s11, s12, s13)
print(f"s10.intersection_update(s11,s12,s13)={s10}")
s10 = se(l1)
s10 &= s11 & s12 & s13
print(f"s10 &= s11 & s12 & s13={s10}")

s10 = se(l1)
s10.difference_update(s11, s12, s13)
print(f"s10.difference_update(s11,s12,s13)={s10}")
s10 = se(l1)
s10 -= s11 | s12 | s13
print(f"s10 -= s11 | s12 | s13={s10}")


s10 = se(l1)
s10.symmetric_difference_update(s11, s12, s13)
print(f"s10.symmetric_difference_update(s11,s12,s13)={s10}")
s10 = se(l1)
s10 ^= s11
print(f"s10 ^= s11={s10}")

s10 = se(l1)
s10.add(110)
print(f"s10.add(110)={s10}")
s10.remove(110)
print(f"s10.remove(110)={s10}")

try:
    s10.remove(110000)
    print(f"s10.discard(110000)={s10}")
except Exception as fe:
    print(fe)
s10.discard(8)
print(f"s10.discard(8)={s10}")

s10.discard(110000)
print(f"s10.discard(110000)={s10}")

print(f"{s10.pop()=}")
s10.clear()
print(f"{s10}")
#########################################################################################
s10 = se(l1)
s10.appendleft(500)
print(f"s10.appendleft(500)={s10}")

s10.extend([5000, 14500])
print(f"s10.extend([5000,14500])={s10}")

s10.extendleft([35000, 314500])
print(f"s10.extendleft([35000,314500])={s10}")


print(f"{s10.index(35000)=}")


s10.insert(3, 1114500)
print(f"s10.insert(3,1114500)={s10}")
print(f"{s10.popleft()=}")

s10.rotate(1)
print(f"s10.rotate(1)={s10}")

s10.reverse()
print(f"s10.reverse()={s10}")

# Output

s1=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8])
len(s1)=10
9 in s1=True
19 in s1=False
9 not in s1=False
19 not in s1=True
s1.isdisjoint(se(l4))=True
s1.isdisjoint(l4)=True
s1.issubset(se(l3))=False
s1 <= se(l3)=False
s1 < se(l3)=False
se(l3).issubset(s1)=True
se(l3) <= s1=True
se(l3) < s1=True
s1.issuperset(se(l3))=True
s1 >=se(l3)=True
s1 >se(l3)=True
se(l3).issuperset(s1)=False
se(l3) >= s1=False
se(l3) > s1=False
s1.union(l1,l2,l3,l4)=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])
s1.union(se(l1),se(l2),se(l3),se(l4))=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])
s1 | l2 | l3 | l4=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])
s1 | tuple(l2) | se(l3) | se(l4)=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])
[x**2 for x in s1]=[81, 0, 1, 4, 9, 16, 25, 36, 49, 64]
s1.intersection(l1,l2,l3)=ScrewHashesSet([5, 3, 4])
s1.intersection(se(l1),se(l2),se(l3))=ScrewHashesSet([5, 3, 4])
s1 & l2 & l3=ScrewHashesSet([5, 3, 4])
s1 & tuple(l2) & se(l3)=ScrewHashesSet([5, 3, 4])
s1.difference(l2,l3)=ScrewHashesSet([0, 1, 2, 8])
s1.difference(se(l2),se(l3))=ScrewHashesSet([0, 1, 2, 8])
s1 - l2 - l3=ScrewHashesSet([0, 1, 2, 8])
s1 - tuple(l2) - se(l3)=ScrewHashesSet([0, 1, 2, 8])
s1.symmetric_difference(l2,l3)=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])
s1.symmetric_difference(se(l2),se(l3))=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])
s1 ^ l2 ^ l3=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])
s1 ^ tuple(l2) ^ se(l3)=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])
s6 is s1=False
s6 == s1=True
s6.update(l4)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22}
s6.update(se(l2))={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22, 12, 10, 11, 13}
s7 |= l4={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22}
s7 |= se(l2)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22, 12, 10, 11, 13}
s10.intersection_update(s11,s12,s13)={}
s10 &= s11 & s12 & s13={}
s10.difference_update(s11,s12,s13)={0, 1, 2, 8}
s10 -= s11 | s12 | s13={0, 1, 2, 8}
s10.symmetric_difference_update(s11,s12,s13)={0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4, 19, 20, 21, 22}
s10 ^= s11={0, 1, 2, 8, 12, 10, 11, 13}
s10.add(110)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 110}
s10.remove(110)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8}
110000 is not in deque
s10.discard(8)={9, 0, 1, 2, 3, 4, 5, 6, 7}
s10.discard(110000)={9, 0, 1, 2, 3, 4, 5, 6, 7}
s10.pop()=7
{}
s10.appendleft(500)={500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8}
s10.extend([5000,14500])={500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000, 14500}
s10.extendleft([35000,314500])={314500, 35000, 500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000, 14500}
s10.index(35000)=1
s10.insert(3,1114500)={314500, 35000, 500, 1114500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000, 14500}
s10.popleft()=314500
s10.rotate(1)={14500, 35000, 500, 1114500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000}
s10.reverse()={5000, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 1114500, 500, 35000, 14500}

```


## Examples with mutables

```python
l1 = [
    [0, 1],
    [0, 1],
    [0, 1],
    [1, 2],
    [1, 2],
    [2, 3],
    [3, 4],
    [4, 5],
    [5, 6],
    [6, 7],
    [7, 8],
    [8, 9],
]
l2 = [[2, 3], [3, 4], [4, 5], [5, 6], [11, 12], [11, 12], [12, 13], [14, 15], [15, 16]]
l3 = [[3, 4], [4, 5], [5, 6]]
l4 = [[19, 20], [21, 22], [22, 23], {24: 25}]
s1 = se(l1)
print(f"{s1=}")
print(f"{len(s1)=}")
print(f"{9 in s1=}")
print(f"{19 in s1=}")
print(f"{9 not in s1=}")
print(f"{19 not in s1=}")
print(f"{s1.isdisjoint(se(l4))=}")
print(f"{s1.isdisjoint(l4)=}")
print(f"{s1.issubset(se(l3))=}")
print(f"{s1 <= se(l3)=}")
print(f"{s1 < se(l3)=}")
print(f"{se(l3).issubset(s1)=}")
print(f"{se(l3) <= s1=}")
print(f"{se(l3) < s1=}")

print(f"{s1.issuperset(se(l3))=}")
print(f"{s1 >=se(l3)=}")
print(f"{s1 >se(l3)=}")

print(f"{se(l3).issuperset(s1)=}")
print(f"{se(l3) >= s1=}")
print(f"{se(l3) > s1=}")


print(f"{s1.union(l1,l2,l3,l4)=}")
print(f"{s1.union(se(l1),se(l2),se(l3),se(l4))=}")
print(f"{s1 | l2 | l3 | l4=}")
print(f"{s1 | tuple(l2) | se(l3) | se(l4)=}")


print(f"{s1.intersection(l1,l2,l3)=}")
print(f"{s1.intersection(se(l1),se(l2),se(l3))=}")
print(f"{s1 & l2 & l3=}")
print(f"{s1 & tuple(l2) & se(l3)=}")


print(f"{s1.difference(l2,l3)=}")
print(f"{s1.difference(se(l2),se(l3))=}")
print(f"{s1 - l2 - l3=}")
print(f"{s1 - tuple(l2) - se(l3)=}")

print(f"{s1.symmetric_difference(l2,l3)=}")
print(f"{s1.symmetric_difference(se(l2),se(l3))=}")
print(f"{s1 ^ l2 ^ l3=}")
print(f"{s1 ^ tuple(l2) ^ se(l3)=}")

s6 = s1.copy()
print(f"{s6 is s1=}")
print(f"{s6 == s1=}")

s6.update(l4)
print(f"s6.update(l4)={s6}")
s6.update(se(l2))
print(f"s6.update(se(l2))={s6}")

s7 = s1.copy()
s7 |= l4
print(f"s7 |= l4={s7}")
s7 |= se(l2)
print(f"s7 |= se(l2)={s7}")

s10 = se(l1)
s11 = se(l2)
s12 = se(l3)
s13 = se(l4)
s10.intersection_update(s11, s12, s13)
print(f"s10.intersection_update(s11,s12,s13)={s10}")
s10 = se(l1)
s10 &= s11 & s12 & s13
print(f"s10 &= s11 & s12 & s13={s10}")

s10 = se(l1)
s10.difference_update(s11, s12, s13)
print(f"s10.difference_update(s11,s12,s13)={s10}")
s10 = se(l1)
s10 -= s11 | s12 | s13
print(f"s10 -= s11 | s12 | s13={s10}")


s10 = se(l1)
s10.symmetric_difference_update(s11, s12, s13)
print(f"s10.symmetric_difference_update(s11,s12,s13)={s10}")
s10 = se(l1)
s10 ^= s11
print(f"s10 ^= s11={s10}")

s10 = se(l1)
s10.add(110)
print(f"s10.add(110)={s10}")
s10.remove(110)
print(f"s10.remove(110)={s10}")

try:
    s10.remove(110000)
    print(f"s10.discard(110000)={s10}")
except Exception as fe:
    print(fe)
s10.discard(8)
print(f"s10.discard(8)={s10}")

s10.discard(110000)
print(f"s10.discard(110000)={s10}")

print(f"{s10.pop()=}")
s10.clear()
print(f"{s10}")
#########################################################################################
s10 = se(l1)
s10.appendleft(500)
print(f"s10.appendleft(500)={s10}")

s10.extend([5000, 14500])
print(f"s10.extend([5000,14500])={s10}")

s10.extendleft([35000, 314500])
print(f"s10.extendleft([35000,314500])={s10}")


print(f"{s10.index(35000)=}")


s10.insert(3, 1114500)
print(f"s10.insert(3,1114500)={s10}")
print(f"{s10.popleft()=}")

s10.rotate(1)
print(f"s10.rotate(1)={s10}")

s10.reverse()
print(f"s10.reverse()={s10}")


# Output 

s1=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]])
len(s1)=9
9 in s1=False
19 in s1=False
9 not in s1=True
19 not in s1=True
s1.isdisjoint(se(l4))=True
s1.isdisjoint(l4)=True
s1.issubset(se(l3))=False
s1 <= se(l3)=False
s1 < se(l3)=False
se(l3).issubset(s1)=True
se(l3) <= s1=True
se(l3) < s1=True
s1.issuperset(se(l3))=True
s1 >=se(l3)=True
s1 >se(l3)=True
se(l3).issuperset(s1)=False
se(l3) >= s1=False
se(l3) > s1=False
s1.union(l1,l2,l3,l4)=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])
s1.union(se(l1),se(l2),se(l3),se(l4))=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])
s1 | l2 | l3 | l4=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])
s1 | tuple(l2) | se(l3) | se(l4)=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])
s1.intersection(l1,l2,l3)=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])
s1.intersection(se(l1),se(l2),se(l3))=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])
s1 & l2 & l3=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])
s1 & tuple(l2) & se(l3)=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])
s1.difference(l2,l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])
s1.difference(se(l2),se(l3))=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])
s1 - l2 - l3=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])
s1 - tuple(l2) - se(l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])
s1.symmetric_difference(l2,l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])
s1.symmetric_difference(se(l2),se(l3))=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])
s1 ^ l2 ^ l3=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])
s1 ^ tuple(l2) ^ se(l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])
s6 is s1=False
s6 == s1=True
s6.update(l4)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}}
s6.update(se(l2))={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}, [11, 12], [12, 13], [14, 15], [15, 16]}
s7 |= l4={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}}
s7 |= se(l2)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}, [11, 12], [12, 13], [14, 15], [15, 16]}
s10.intersection_update(s11,s12,s13)={}
s10 &= s11 & s12 & s13={}
s10.difference_update(s11,s12,s13)={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]}
s10 -= s11 | s12 | s13={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]}
s10.symmetric_difference_update(s11,s12,s13)={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6], [19, 20], [21, 22], [22, 23], {24: 25}}
s10 ^= s11={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16]}
s10.add(110)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 110}
s10.remove(110)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}
110000 is not in deque
s10.discard(8)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}
s10.discard(110000)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}
s10.pop()=[8, 9]
{}
s10.appendleft(500)={500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}
s10.extend([5000,14500])={500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000, 14500}
s10.extendleft([35000,314500])={314500, 35000, 500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000, 14500}
s10.index(35000)=1
s10.insert(3,1114500)={314500, 35000, 500, 1114500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000, 14500}
s10.popleft()=314500
s10.rotate(1)={14500, 35000, 500, 1114500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000}
s10.reverse()={5000, [8, 9], [7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1], 1114500, 500, 35000, 14500}


```

	
```python
 |  add(self, other, /)
 |      Add an element to the ScrewHashesSet.
 |      
 |      Args:
 |          other: The element to add.
 |  
 |  append(self, other, /)
 |      Append an element to the ScrewHashesSet.
 |      
 |      Args:
 |          other: The element to append.
 |  
 |  appendleft(self, elem, /)
 |      Append an element to the beginning of the ScrewHashesSet if it is not already present.
 |      
 |      Args:
 |          elem: The element to append.
 |  
 |  clear(self)
 |      Remove all elements from the ScrewHashesSet.
 |  
 |  copy(self)
 |      Create a shallow copy of the ScrewHashesSet.
 |      
 |      Returns:
 |          ScrewHashesSet: A shallow copy of the ScrewHashesSet.
 |  
 |  difference(self, *others)
 |      Return a new ScrewHashesSet with elements that are in the current set but not in any of the other sets.
 |      
 |      Args:
 |          *others: Variable number of sets to compute the difference with.
 |      
 |      Returns:
 |          ScrewHashesSet: A new ScrewHashesSet containing the elements that are in the current set but not in any of the other sets.
 |  
 |  difference_update(self, *others)
 |      Update the current ScrewHashesSet with elements that are in the current set but not in any of the other sets.
 |      
 |      Args:
 |          *others: Variable number of sets to compute the difference with.
 |  
 |  discard(self, elem, /)
 |      Remove an element from the set if it is present.
 |      
 |      Args:
 |          elem: The element to be removed from the set.
 |  
 |  extend(self, elem, /)
 |      Extend the ScrewHashesSet by adding elements from an iterable.
 |      
 |      Args:
 |          elem: An iterable containing elements to add to the ScrewHashesSet.
 |  
 |  extendleft(self, elem, /)
 |      Extend the ScrewHashesSet by adding elements from an iterable to the beginning, if they are not already present.
 |      
 |      Args:
 |          elem: An iterable containing elements to add to the ScrewHashesSet.
 |  
 |  index(self, x, start=None, stop=None, /)
 |      Return the index of the first occurrence of an element in the ScrewHashesSet.
 |      
 |      Args:
 |          x: The element to search for.
 |          start (optional): The starting index for the search. If not provided, the search starts from index 0.
 |          stop (optional): The stopping index for the search. If not provided, the search stops at the last index.
 |      
 |      Returns:
 |          int: The index of the first occurrence of the element in the ScrewHashesSet.
 |      
 |      Raises:
 |          ValueError: If the element is not found in the ScrewHashesSet.
 |  
 |  insert(self, i, x, /)
 |      Insert an element at a specified index in the ScrewHashesSet.
 |      
 |      Args:
 |          i: The index at which to insert the element.
 |          x: The element to insert.
 |  
 |  intersection(self, *others)
 |      Return a new ScrewHashesSet with elements that are common to the current set and all the other sets.
 |      
 |      Args:
 |          *others: Variable number of sets to compute the intersection with.
 |      
 |      Returns:
 |          ScrewHashesSet: A new ScrewHashesSet containing the elements that are common to the current set and all the other sets.
 |  
 |  intersection_update(self, *others)
 |      Update the current ScrewHashesSet with elements that are common to the current set and all the other sets.
 |      
 |      Args:
 |          *others: Variable number of sets to compute the intersection with.
 |  
 |  isdisjoint(self, other, /)
 |      Check if the current set has no elements in common with the other set.
 |      
 |      Args:
 |          other: The set to compare with.
 |      
 |      Returns:
 |          bool: True if the sets are disjoint (have no elements in common), False otherwise.
 |  
 |  issubset(self, other, /)
 |      Check if every element in the current set is also in the other set.
 |      
 |      Args:
 |          other: The set to compare with.
 |      
 |      Returns:
 |          bool: True if every element in the current set is also in the other set, False otherwise.
 |  
 |  issuperset(self, other, /)
 |      Check if every element in the other set is also in the current set.
 |      
 |      Args:
 |          other: The set to compare with.
 |      
 |      Returns:
 |          bool: True if every element in the other set is also in the current set, False otherwise.
 |  
 |  pop(self)
 |      Remove and return the rightmost element from the ScrewHashesSet.
 |      
 |      Returns:
 |          object: The removed element.
 |      
 |      Raises:
 |          KeyError: If the ScrewHashesSet is empty.
 |  
 |  popleft(self)
 |      Remove and return the leftmost element from the ScrewHashesSet.
 |      
 |      Returns:
 |          The leftmost element from the ScrewHashesSet.
 |      
 |      Raises:
 |          IndexError: If the ScrewHashesSet is empty.
 |  
 |  remove(self, elem, /)
 |      Remove the specified element from the ScrewHashesSet.
 |      
 |      Args:
 |          elem: The element to remove.
 |      
 |      Raises:
 |          KeyError: If the element is not present in the ScrewHashesSet.
 |  
 |  reverse(self)
 |      Reverse the order of elements in the ScrewHashesSet.
 |  
 |  rotate(self, n=1, /)
 |      Rotate the elements in the ScrewHashesSet by a specified number of steps.
 |      
 |      Args:
 |          n (optional): The number of steps to rotate the elements. Positive values rotate to the right,
 |                        and negative values rotate to the left. The default is 1.
 |  
 |  symmetric_difference(self, *others)
 |      Compute the symmetric difference between the ScrewHashesSet and multiple other sets.
 |      
 |      Args:
 |          *others: Variable length argument list of other sets.
 |      
 |      Returns:
 |          ScrewHashesSet: A new ScrewHashesSet containing elements that are present in exactly one of the sets.
 |  
 |  symmetric_difference_update(self, *others)
 |      Update the ScrewHashesSet with the symmetric difference between itself and multiple other sets.
 |      
 |      Args:
 |          *others: Variable length argument list of other sets.
 |  
 |  union(self, *others)
 |      Compute the union of the ScrewHashesSet and multiple other sets.
 |      
 |      Args:
 |          *others: Variable length argument list of other sets.
 |      
 |      Returns:
 |          ScrewHashesSet: A new ScrewHashesSet containing all unique elements from all sets.
 |  
 |  update(self, *others)
 |      Update the ScrewHashesSet by adding elements from multiple other sets.
 |      
 |      Args:
 |          *others: Variable length argument list of other sets.
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/screwhashesset",
    "name": "screwhashesset",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "set,hash,collections",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/12/c4/23eb394cba783fccb3c4fd356f26446ef6d15529465e461294ff1563ecaf/screwhashesset-0.12.tar.gz",
    "platform": null,
    "description": "\r\n# A set that handles all kinds of objects (hashable or not) and preserves the order of the elements\r\n\r\n## pip install screwhashesset\r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\n\r\nThe module implements a data structure called \"ScrewHashesSet\" \r\nwhich is a custom set implementation in Python. \r\nThe ScrewHashesSet combines the functionality of a set and a deque \r\n(double-ended queue) by using a deque to store the elements and a set \r\nto efficiently perform membership checks.\r\n\r\nThe ScrewHashesSet provides various methods to manipulate and interact with the set, \r\nincluding adding elements, removing elements, checking for membership, \r\nperforming set operations (e.g., union, intersection, difference), and modifying the set in-place.\r\n\r\nThis module can be useful for developers who need to work with sets and \r\nrequire efficient operations for adding, removing, \r\nand checking membership of elements, while also having the flexibility of \r\na deque for efficient element insertion and removal at both ends of the set. \r\nThe ScrewHashesSet can be particularly beneficial in scenarios \r\nwhere the order of elements is important, such as maintaining a \r\nsorted collection or implementing a queue-like data structure.\r\n\r\n### Advantages of using ScrewHashesSet:\r\n\r\n#### Efficient Membership Checks: \r\n\r\nThe underlying set data structure allows for fast membership checks,\r\nproviding constant-time complexity O(1) for determining whether an element is in the set.\r\n\r\n\r\n#### Flexible Element Manipulation: \r\n\r\nThe ScrewHashesSet supports various methods for adding, removing, and modifying elements, \r\nincluding insertion at specific indices and removing elements from both ends of the set.\r\n\r\n#### Compatibility with Mutable Elements:\r\n\r\nAn advantage of using the ScrewHashesSet module is its compatibility with mutable elements. \r\nUnlike the built-in set in Python, which only allows immutable objects as elements, \r\nthe ScrewHashesSet module can handle both mutable and immutable objects.\r\n\r\nThis means that you can use the ScrewHashesSet to store and manipulate objects that can be modified \r\nafter being added to the set. This flexibility is particularly useful when dealing with \r\ncomplex data structures or objects that need to be updated or modified while still being part of the set.\r\n\r\nBy supporting mutable elements, the ScrewHashesSet module provides developers with the ability \r\nto work with a wider range of data types and structures, allowing for more flexible and dynamic use cases. \r\nThis advantage enhances the practicality and versatility of the module, making \r\nit suitable for scenarios where mutable objects need to be stored, manipulated, \r\nand tracked within a set-like data structure.\r\n\r\n#### Preserves Element Order:\r\n\r\nThe ScrewHashesSet utilizes a deque to maintain the order of elements, \r\nensuring that the elements are stored and retrieved in the same order they were added.\r\n\r\n#### Set Operations: \r\n\r\nThe module includes methods for performing common set operations, such as union, \r\nintersection, difference, and symmetric difference, allowing developers to combine and \r\nmanipulate sets efficiently.\r\n\r\n#### Modifiable In-Place:\r\n\r\nMany methods of ScrewHashesSet modify the set in-place, providing the advantage of not requiring \r\nadditional memory allocation when modifying the set's contents.\r\n\r\n\r\n\r\n\r\n## Import it \r\n\r\n```python\r\nfrom screwhashesset import ScrewHashesSet as se\r\n```\r\n\r\n## Examples with unmutables\r\n\r\n```python\r\nl1 = [\r\n    9,\r\n    0,\r\n    1,\r\n    2,\r\n    3,\r\n    4,\r\n    5,\r\n    6,\r\n    7,\r\n    8,\r\n    9,\r\n    9,\r\n]\r\nl2 = [12, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13]\r\nl3 = [5, 3, 4, 5]\r\nl4 = [19, 20, 21, 22]\r\ns1 = se(l1)\r\nprint(f\"{s1=}\")\r\nprint(f\"{len(s1)=}\")\r\nprint(f\"{9 in s1=}\")\r\nprint(f\"{19 in s1=}\")\r\nprint(f\"{9 not in s1=}\")\r\nprint(f\"{19 not in s1=}\")\r\nprint(f\"{s1.isdisjoint(se(l4))=}\")\r\nprint(f\"{s1.isdisjoint(l4)=}\")\r\nprint(f\"{s1.issubset(se(l3))=}\")\r\nprint(f\"{s1 <= se(l3)=}\")\r\nprint(f\"{s1 < se(l3)=}\")\r\nprint(f\"{se(l3).issubset(s1)=}\")\r\nprint(f\"{se(l3) <= s1=}\")\r\nprint(f\"{se(l3) < s1=}\")\r\n\r\nprint(f\"{s1.issuperset(se(l3))=}\")\r\nprint(f\"{s1 >=se(l3)=}\")\r\nprint(f\"{s1 >se(l3)=}\")\r\n\r\nprint(f\"{se(l3).issuperset(s1)=}\")\r\nprint(f\"{se(l3) >= s1=}\")\r\nprint(f\"{se(l3) > s1=}\")\r\n\r\n\r\nprint(f\"{s1.union(l1,l2,l3,l4)=}\")\r\nprint(f\"{s1.union(se(l1),se(l2),se(l3),se(l4))=}\")\r\nprint(f\"{s1 | l2 | l3 | l4=}\")\r\nprint(f\"{s1 | tuple(l2) | se(l3) | se(l4)=}\")\r\n\r\nprint(f\"{[x**2 for x in s1]=}\")\r\n\r\n\r\nprint(f\"{s1.intersection(l1,l2,l3)=}\")\r\nprint(f\"{s1.intersection(se(l1),se(l2),se(l3))=}\")\r\nprint(f\"{s1 & l2 & l3=}\")\r\nprint(f\"{s1 & tuple(l2) & se(l3)=}\")\r\n\r\n\r\nprint(f\"{s1.difference(l2,l3)=}\")\r\nprint(f\"{s1.difference(se(l2),se(l3))=}\")\r\nprint(f\"{s1 - l2 - l3=}\")\r\nprint(f\"{s1 - tuple(l2) - se(l3)=}\")\r\n\r\nprint(f\"{s1.symmetric_difference(l2,l3)=}\")\r\nprint(f\"{s1.symmetric_difference(se(l2),se(l3))=}\")\r\nprint(f\"{s1 ^ l2 ^ l3=}\")\r\nprint(f\"{s1 ^ tuple(l2) ^ se(l3)=}\")\r\n\r\ns6 = s1.copy()\r\nprint(f\"{s6 is s1=}\")\r\nprint(f\"{s6 == s1=}\")\r\n\r\ns6.update(l4)\r\nprint(f\"s6.update(l4)={s6}\")\r\ns6.update(se(l2))\r\nprint(f\"s6.update(se(l2))={s6}\")\r\n\r\ns7 = s1.copy()\r\ns7 |= l4\r\nprint(f\"s7 |= l4={s7}\")\r\ns7 |= se(l2)\r\nprint(f\"s7 |= se(l2)={s7}\")\r\n\r\ns10 = se(l1)\r\ns11 = se(l2)\r\ns12 = se(l3)\r\ns13 = se(l4)\r\ns10.intersection_update(s11, s12, s13)\r\nprint(f\"s10.intersection_update(s11,s12,s13)={s10}\")\r\ns10 = se(l1)\r\ns10 &= s11 & s12 & s13\r\nprint(f\"s10 &= s11 & s12 & s13={s10}\")\r\n\r\ns10 = se(l1)\r\ns10.difference_update(s11, s12, s13)\r\nprint(f\"s10.difference_update(s11,s12,s13)={s10}\")\r\ns10 = se(l1)\r\ns10 -= s11 | s12 | s13\r\nprint(f\"s10 -= s11 | s12 | s13={s10}\")\r\n\r\n\r\ns10 = se(l1)\r\ns10.symmetric_difference_update(s11, s12, s13)\r\nprint(f\"s10.symmetric_difference_update(s11,s12,s13)={s10}\")\r\ns10 = se(l1)\r\ns10 ^= s11\r\nprint(f\"s10 ^= s11={s10}\")\r\n\r\ns10 = se(l1)\r\ns10.add(110)\r\nprint(f\"s10.add(110)={s10}\")\r\ns10.remove(110)\r\nprint(f\"s10.remove(110)={s10}\")\r\n\r\ntry:\r\n    s10.remove(110000)\r\n    print(f\"s10.discard(110000)={s10}\")\r\nexcept Exception as fe:\r\n    print(fe)\r\ns10.discard(8)\r\nprint(f\"s10.discard(8)={s10}\")\r\n\r\ns10.discard(110000)\r\nprint(f\"s10.discard(110000)={s10}\")\r\n\r\nprint(f\"{s10.pop()=}\")\r\ns10.clear()\r\nprint(f\"{s10}\")\r\n#########################################################################################\r\ns10 = se(l1)\r\ns10.appendleft(500)\r\nprint(f\"s10.appendleft(500)={s10}\")\r\n\r\ns10.extend([5000, 14500])\r\nprint(f\"s10.extend([5000,14500])={s10}\")\r\n\r\ns10.extendleft([35000, 314500])\r\nprint(f\"s10.extendleft([35000,314500])={s10}\")\r\n\r\n\r\nprint(f\"{s10.index(35000)=}\")\r\n\r\n\r\ns10.insert(3, 1114500)\r\nprint(f\"s10.insert(3,1114500)={s10}\")\r\nprint(f\"{s10.popleft()=}\")\r\n\r\ns10.rotate(1)\r\nprint(f\"s10.rotate(1)={s10}\")\r\n\r\ns10.reverse()\r\nprint(f\"s10.reverse()={s10}\")\r\n\r\n# Output\r\n\r\ns1=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8])\r\nlen(s1)=10\r\n9 in s1=True\r\n19 in s1=False\r\n9 not in s1=False\r\n19 not in s1=True\r\ns1.isdisjoint(se(l4))=True\r\ns1.isdisjoint(l4)=True\r\ns1.issubset(se(l3))=False\r\ns1 <= se(l3)=False\r\ns1 < se(l3)=False\r\nse(l3).issubset(s1)=True\r\nse(l3) <= s1=True\r\nse(l3) < s1=True\r\ns1.issuperset(se(l3))=True\r\ns1 >=se(l3)=True\r\ns1 >se(l3)=True\r\nse(l3).issuperset(s1)=False\r\nse(l3) >= s1=False\r\nse(l3) > s1=False\r\ns1.union(l1,l2,l3,l4)=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])\r\ns1.union(se(l1),se(l2),se(l3),se(l4))=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])\r\ns1 | l2 | l3 | l4=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])\r\ns1 | tuple(l2) | se(l3) | se(l4)=ScrewHashesSet([9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 13, 19, 20, 21, 22])\r\n[x**2 for x in s1]=[81, 0, 1, 4, 9, 16, 25, 36, 49, 64]\r\ns1.intersection(l1,l2,l3)=ScrewHashesSet([5, 3, 4])\r\ns1.intersection(se(l1),se(l2),se(l3))=ScrewHashesSet([5, 3, 4])\r\ns1 & l2 & l3=ScrewHashesSet([5, 3, 4])\r\ns1 & tuple(l2) & se(l3)=ScrewHashesSet([5, 3, 4])\r\ns1.difference(l2,l3)=ScrewHashesSet([0, 1, 2, 8])\r\ns1.difference(se(l2),se(l3))=ScrewHashesSet([0, 1, 2, 8])\r\ns1 - l2 - l3=ScrewHashesSet([0, 1, 2, 8])\r\ns1 - tuple(l2) - se(l3)=ScrewHashesSet([0, 1, 2, 8])\r\ns1.symmetric_difference(l2,l3)=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])\r\ns1.symmetric_difference(se(l2),se(l3))=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])\r\ns1 ^ l2 ^ l3=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])\r\ns1 ^ tuple(l2) ^ se(l3)=ScrewHashesSet([0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4])\r\ns6 is s1=False\r\ns6 == s1=True\r\ns6.update(l4)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22}\r\ns6.update(se(l2))={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22, 12, 10, 11, 13}\r\ns7 |= l4={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22}\r\ns7 |= se(l2)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 20, 21, 22, 12, 10, 11, 13}\r\ns10.intersection_update(s11,s12,s13)={}\r\ns10 &= s11 & s12 & s13={}\r\ns10.difference_update(s11,s12,s13)={0, 1, 2, 8}\r\ns10 -= s11 | s12 | s13={0, 1, 2, 8}\r\ns10.symmetric_difference_update(s11,s12,s13)={0, 1, 2, 8, 12, 10, 11, 13, 5, 3, 4, 19, 20, 21, 22}\r\ns10 ^= s11={0, 1, 2, 8, 12, 10, 11, 13}\r\ns10.add(110)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 110}\r\ns10.remove(110)={9, 0, 1, 2, 3, 4, 5, 6, 7, 8}\r\n110000 is not in deque\r\ns10.discard(8)={9, 0, 1, 2, 3, 4, 5, 6, 7}\r\ns10.discard(110000)={9, 0, 1, 2, 3, 4, 5, 6, 7}\r\ns10.pop()=7\r\n{}\r\ns10.appendleft(500)={500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8}\r\ns10.extend([5000,14500])={500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000, 14500}\r\ns10.extendleft([35000,314500])={314500, 35000, 500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000, 14500}\r\ns10.index(35000)=1\r\ns10.insert(3,1114500)={314500, 35000, 500, 1114500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000, 14500}\r\ns10.popleft()=314500\r\ns10.rotate(1)={14500, 35000, 500, 1114500, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 5000}\r\ns10.reverse()={5000, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 1114500, 500, 35000, 14500}\r\n\r\n```\r\n\r\n\r\n## Examples with mutables\r\n\r\n```python\r\nl1 = [\r\n    [0, 1],\r\n    [0, 1],\r\n    [0, 1],\r\n    [1, 2],\r\n    [1, 2],\r\n    [2, 3],\r\n    [3, 4],\r\n    [4, 5],\r\n    [5, 6],\r\n    [6, 7],\r\n    [7, 8],\r\n    [8, 9],\r\n]\r\nl2 = [[2, 3], [3, 4], [4, 5], [5, 6], [11, 12], [11, 12], [12, 13], [14, 15], [15, 16]]\r\nl3 = [[3, 4], [4, 5], [5, 6]]\r\nl4 = [[19, 20], [21, 22], [22, 23], {24: 25}]\r\ns1 = se(l1)\r\nprint(f\"{s1=}\")\r\nprint(f\"{len(s1)=}\")\r\nprint(f\"{9 in s1=}\")\r\nprint(f\"{19 in s1=}\")\r\nprint(f\"{9 not in s1=}\")\r\nprint(f\"{19 not in s1=}\")\r\nprint(f\"{s1.isdisjoint(se(l4))=}\")\r\nprint(f\"{s1.isdisjoint(l4)=}\")\r\nprint(f\"{s1.issubset(se(l3))=}\")\r\nprint(f\"{s1 <= se(l3)=}\")\r\nprint(f\"{s1 < se(l3)=}\")\r\nprint(f\"{se(l3).issubset(s1)=}\")\r\nprint(f\"{se(l3) <= s1=}\")\r\nprint(f\"{se(l3) < s1=}\")\r\n\r\nprint(f\"{s1.issuperset(se(l3))=}\")\r\nprint(f\"{s1 >=se(l3)=}\")\r\nprint(f\"{s1 >se(l3)=}\")\r\n\r\nprint(f\"{se(l3).issuperset(s1)=}\")\r\nprint(f\"{se(l3) >= s1=}\")\r\nprint(f\"{se(l3) > s1=}\")\r\n\r\n\r\nprint(f\"{s1.union(l1,l2,l3,l4)=}\")\r\nprint(f\"{s1.union(se(l1),se(l2),se(l3),se(l4))=}\")\r\nprint(f\"{s1 | l2 | l3 | l4=}\")\r\nprint(f\"{s1 | tuple(l2) | se(l3) | se(l4)=}\")\r\n\r\n\r\nprint(f\"{s1.intersection(l1,l2,l3)=}\")\r\nprint(f\"{s1.intersection(se(l1),se(l2),se(l3))=}\")\r\nprint(f\"{s1 & l2 & l3=}\")\r\nprint(f\"{s1 & tuple(l2) & se(l3)=}\")\r\n\r\n\r\nprint(f\"{s1.difference(l2,l3)=}\")\r\nprint(f\"{s1.difference(se(l2),se(l3))=}\")\r\nprint(f\"{s1 - l2 - l3=}\")\r\nprint(f\"{s1 - tuple(l2) - se(l3)=}\")\r\n\r\nprint(f\"{s1.symmetric_difference(l2,l3)=}\")\r\nprint(f\"{s1.symmetric_difference(se(l2),se(l3))=}\")\r\nprint(f\"{s1 ^ l2 ^ l3=}\")\r\nprint(f\"{s1 ^ tuple(l2) ^ se(l3)=}\")\r\n\r\ns6 = s1.copy()\r\nprint(f\"{s6 is s1=}\")\r\nprint(f\"{s6 == s1=}\")\r\n\r\ns6.update(l4)\r\nprint(f\"s6.update(l4)={s6}\")\r\ns6.update(se(l2))\r\nprint(f\"s6.update(se(l2))={s6}\")\r\n\r\ns7 = s1.copy()\r\ns7 |= l4\r\nprint(f\"s7 |= l4={s7}\")\r\ns7 |= se(l2)\r\nprint(f\"s7 |= se(l2)={s7}\")\r\n\r\ns10 = se(l1)\r\ns11 = se(l2)\r\ns12 = se(l3)\r\ns13 = se(l4)\r\ns10.intersection_update(s11, s12, s13)\r\nprint(f\"s10.intersection_update(s11,s12,s13)={s10}\")\r\ns10 = se(l1)\r\ns10 &= s11 & s12 & s13\r\nprint(f\"s10 &= s11 & s12 & s13={s10}\")\r\n\r\ns10 = se(l1)\r\ns10.difference_update(s11, s12, s13)\r\nprint(f\"s10.difference_update(s11,s12,s13)={s10}\")\r\ns10 = se(l1)\r\ns10 -= s11 | s12 | s13\r\nprint(f\"s10 -= s11 | s12 | s13={s10}\")\r\n\r\n\r\ns10 = se(l1)\r\ns10.symmetric_difference_update(s11, s12, s13)\r\nprint(f\"s10.symmetric_difference_update(s11,s12,s13)={s10}\")\r\ns10 = se(l1)\r\ns10 ^= s11\r\nprint(f\"s10 ^= s11={s10}\")\r\n\r\ns10 = se(l1)\r\ns10.add(110)\r\nprint(f\"s10.add(110)={s10}\")\r\ns10.remove(110)\r\nprint(f\"s10.remove(110)={s10}\")\r\n\r\ntry:\r\n    s10.remove(110000)\r\n    print(f\"s10.discard(110000)={s10}\")\r\nexcept Exception as fe:\r\n    print(fe)\r\ns10.discard(8)\r\nprint(f\"s10.discard(8)={s10}\")\r\n\r\ns10.discard(110000)\r\nprint(f\"s10.discard(110000)={s10}\")\r\n\r\nprint(f\"{s10.pop()=}\")\r\ns10.clear()\r\nprint(f\"{s10}\")\r\n#########################################################################################\r\ns10 = se(l1)\r\ns10.appendleft(500)\r\nprint(f\"s10.appendleft(500)={s10}\")\r\n\r\ns10.extend([5000, 14500])\r\nprint(f\"s10.extend([5000,14500])={s10}\")\r\n\r\ns10.extendleft([35000, 314500])\r\nprint(f\"s10.extendleft([35000,314500])={s10}\")\r\n\r\n\r\nprint(f\"{s10.index(35000)=}\")\r\n\r\n\r\ns10.insert(3, 1114500)\r\nprint(f\"s10.insert(3,1114500)={s10}\")\r\nprint(f\"{s10.popleft()=}\")\r\n\r\ns10.rotate(1)\r\nprint(f\"s10.rotate(1)={s10}\")\r\n\r\ns10.reverse()\r\nprint(f\"s10.reverse()={s10}\")\r\n\r\n\r\n# Output \r\n\r\ns1=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]])\r\nlen(s1)=9\r\n9 in s1=False\r\n19 in s1=False\r\n9 not in s1=True\r\n19 not in s1=True\r\ns1.isdisjoint(se(l4))=True\r\ns1.isdisjoint(l4)=True\r\ns1.issubset(se(l3))=False\r\ns1 <= se(l3)=False\r\ns1 < se(l3)=False\r\nse(l3).issubset(s1)=True\r\nse(l3) <= s1=True\r\nse(l3) < s1=True\r\ns1.issuperset(se(l3))=True\r\ns1 >=se(l3)=True\r\ns1 >se(l3)=True\r\nse(l3).issuperset(s1)=False\r\nse(l3) >= s1=False\r\nse(l3) > s1=False\r\ns1.union(l1,l2,l3,l4)=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])\r\ns1.union(se(l1),se(l2),se(l3),se(l4))=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])\r\ns1 | l2 | l3 | l4=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])\r\ns1 | tuple(l2) | se(l3) | se(l4)=ScrewHashesSet([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [19, 20], [21, 22], [22, 23], {24: 25}])\r\ns1.intersection(l1,l2,l3)=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])\r\ns1.intersection(se(l1),se(l2),se(l3))=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])\r\ns1 & l2 & l3=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])\r\ns1 & tuple(l2) & se(l3)=ScrewHashesSet([[3, 4], [4, 5], [5, 6]])\r\ns1.difference(l2,l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])\r\ns1.difference(se(l2),se(l3))=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])\r\ns1 - l2 - l3=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])\r\ns1 - tuple(l2) - se(l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]])\r\ns1.symmetric_difference(l2,l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])\r\ns1.symmetric_difference(se(l2),se(l3))=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])\r\ns1 ^ l2 ^ l3=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])\r\ns1 ^ tuple(l2) ^ se(l3)=ScrewHashesSet([[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6]])\r\ns6 is s1=False\r\ns6 == s1=True\r\ns6.update(l4)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}}\r\ns6.update(se(l2))={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}, [11, 12], [12, 13], [14, 15], [15, 16]}\r\ns7 |= l4={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}}\r\ns7 |= se(l2)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [19, 20], [21, 22], [22, 23], {24: 25}, [11, 12], [12, 13], [14, 15], [15, 16]}\r\ns10.intersection_update(s11,s12,s13)={}\r\ns10 &= s11 & s12 & s13={}\r\ns10.difference_update(s11,s12,s13)={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]}\r\ns10 -= s11 | s12 | s13={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9]}\r\ns10.symmetric_difference_update(s11,s12,s13)={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16], [3, 4], [4, 5], [5, 6], [19, 20], [21, 22], [22, 23], {24: 25}}\r\ns10 ^= s11={[0, 1], [1, 2], [6, 7], [7, 8], [8, 9], [11, 12], [12, 13], [14, 15], [15, 16]}\r\ns10.add(110)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 110}\r\ns10.remove(110)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}\r\n110000 is not in deque\r\ns10.discard(8)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}\r\ns10.discard(110000)={[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}\r\ns10.pop()=[8, 9]\r\n{}\r\ns10.appendleft(500)={500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]}\r\ns10.extend([5000,14500])={500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000, 14500}\r\ns10.extendleft([35000,314500])={314500, 35000, 500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000, 14500}\r\ns10.index(35000)=1\r\ns10.insert(3,1114500)={314500, 35000, 500, 1114500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000, 14500}\r\ns10.popleft()=314500\r\ns10.rotate(1)={14500, 35000, 500, 1114500, [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 5000}\r\ns10.reverse()={5000, [8, 9], [7, 8], [6, 7], [5, 6], [4, 5], [3, 4], [2, 3], [1, 2], [0, 1], 1114500, 500, 35000, 14500}\r\n\r\n\r\n```\r\n\r\n\t\r\n```python\r\n |  add(self, other, /)\r\n |      Add an element to the ScrewHashesSet.\r\n |      \r\n |      Args:\r\n |          other: The element to add.\r\n |  \r\n |  append(self, other, /)\r\n |      Append an element to the ScrewHashesSet.\r\n |      \r\n |      Args:\r\n |          other: The element to append.\r\n |  \r\n |  appendleft(self, elem, /)\r\n |      Append an element to the beginning of the ScrewHashesSet if it is not already present.\r\n |      \r\n |      Args:\r\n |          elem: The element to append.\r\n |  \r\n |  clear(self)\r\n |      Remove all elements from the ScrewHashesSet.\r\n |  \r\n |  copy(self)\r\n |      Create a shallow copy of the ScrewHashesSet.\r\n |      \r\n |      Returns:\r\n |          ScrewHashesSet: A shallow copy of the ScrewHashesSet.\r\n |  \r\n |  difference(self, *others)\r\n |      Return a new ScrewHashesSet with elements that are in the current set but not in any of the other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable number of sets to compute the difference with.\r\n |      \r\n |      Returns:\r\n |          ScrewHashesSet: A new ScrewHashesSet containing the elements that are in the current set but not in any of the other sets.\r\n |  \r\n |  difference_update(self, *others)\r\n |      Update the current ScrewHashesSet with elements that are in the current set but not in any of the other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable number of sets to compute the difference with.\r\n |  \r\n |  discard(self, elem, /)\r\n |      Remove an element from the set if it is present.\r\n |      \r\n |      Args:\r\n |          elem: The element to be removed from the set.\r\n |  \r\n |  extend(self, elem, /)\r\n |      Extend the ScrewHashesSet by adding elements from an iterable.\r\n |      \r\n |      Args:\r\n |          elem: An iterable containing elements to add to the ScrewHashesSet.\r\n |  \r\n |  extendleft(self, elem, /)\r\n |      Extend the ScrewHashesSet by adding elements from an iterable to the beginning, if they are not already present.\r\n |      \r\n |      Args:\r\n |          elem: An iterable containing elements to add to the ScrewHashesSet.\r\n |  \r\n |  index(self, x, start=None, stop=None, /)\r\n |      Return the index of the first occurrence of an element in the ScrewHashesSet.\r\n |      \r\n |      Args:\r\n |          x: The element to search for.\r\n |          start (optional): The starting index for the search. If not provided, the search starts from index 0.\r\n |          stop (optional): The stopping index for the search. If not provided, the search stops at the last index.\r\n |      \r\n |      Returns:\r\n |          int: The index of the first occurrence of the element in the ScrewHashesSet.\r\n |      \r\n |      Raises:\r\n |          ValueError: If the element is not found in the ScrewHashesSet.\r\n |  \r\n |  insert(self, i, x, /)\r\n |      Insert an element at a specified index in the ScrewHashesSet.\r\n |      \r\n |      Args:\r\n |          i: The index at which to insert the element.\r\n |          x: The element to insert.\r\n |  \r\n |  intersection(self, *others)\r\n |      Return a new ScrewHashesSet with elements that are common to the current set and all the other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable number of sets to compute the intersection with.\r\n |      \r\n |      Returns:\r\n |          ScrewHashesSet: A new ScrewHashesSet containing the elements that are common to the current set and all the other sets.\r\n |  \r\n |  intersection_update(self, *others)\r\n |      Update the current ScrewHashesSet with elements that are common to the current set and all the other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable number of sets to compute the intersection with.\r\n |  \r\n |  isdisjoint(self, other, /)\r\n |      Check if the current set has no elements in common with the other set.\r\n |      \r\n |      Args:\r\n |          other: The set to compare with.\r\n |      \r\n |      Returns:\r\n |          bool: True if the sets are disjoint (have no elements in common), False otherwise.\r\n |  \r\n |  issubset(self, other, /)\r\n |      Check if every element in the current set is also in the other set.\r\n |      \r\n |      Args:\r\n |          other: The set to compare with.\r\n |      \r\n |      Returns:\r\n |          bool: True if every element in the current set is also in the other set, False otherwise.\r\n |  \r\n |  issuperset(self, other, /)\r\n |      Check if every element in the other set is also in the current set.\r\n |      \r\n |      Args:\r\n |          other: The set to compare with.\r\n |      \r\n |      Returns:\r\n |          bool: True if every element in the other set is also in the current set, False otherwise.\r\n |  \r\n |  pop(self)\r\n |      Remove and return the rightmost element from the ScrewHashesSet.\r\n |      \r\n |      Returns:\r\n |          object: The removed element.\r\n |      \r\n |      Raises:\r\n |          KeyError: If the ScrewHashesSet is empty.\r\n |  \r\n |  popleft(self)\r\n |      Remove and return the leftmost element from the ScrewHashesSet.\r\n |      \r\n |      Returns:\r\n |          The leftmost element from the ScrewHashesSet.\r\n |      \r\n |      Raises:\r\n |          IndexError: If the ScrewHashesSet is empty.\r\n |  \r\n |  remove(self, elem, /)\r\n |      Remove the specified element from the ScrewHashesSet.\r\n |      \r\n |      Args:\r\n |          elem: The element to remove.\r\n |      \r\n |      Raises:\r\n |          KeyError: If the element is not present in the ScrewHashesSet.\r\n |  \r\n |  reverse(self)\r\n |      Reverse the order of elements in the ScrewHashesSet.\r\n |  \r\n |  rotate(self, n=1, /)\r\n |      Rotate the elements in the ScrewHashesSet by a specified number of steps.\r\n |      \r\n |      Args:\r\n |          n (optional): The number of steps to rotate the elements. Positive values rotate to the right,\r\n |                        and negative values rotate to the left. The default is 1.\r\n |  \r\n |  symmetric_difference(self, *others)\r\n |      Compute the symmetric difference between the ScrewHashesSet and multiple other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable length argument list of other sets.\r\n |      \r\n |      Returns:\r\n |          ScrewHashesSet: A new ScrewHashesSet containing elements that are present in exactly one of the sets.\r\n |  \r\n |  symmetric_difference_update(self, *others)\r\n |      Update the ScrewHashesSet with the symmetric difference between itself and multiple other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable length argument list of other sets.\r\n |  \r\n |  union(self, *others)\r\n |      Compute the union of the ScrewHashesSet and multiple other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable length argument list of other sets.\r\n |      \r\n |      Returns:\r\n |          ScrewHashesSet: A new ScrewHashesSet containing all unique elements from all sets.\r\n |  \r\n |  update(self, *others)\r\n |      Update the ScrewHashesSet by adding elements from multiple other sets.\r\n |      \r\n |      Args:\r\n |          *others: Variable length argument list of other sets.\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A set that handles all kinds of objects (hashable or not) and preserves the order of the elements",
    "version": "0.12",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/screwhashesset"
    },
    "split_keywords": [
        "set",
        "hash",
        "collections"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f31dcfbb9da804d8fdbd39467ffe28227f0eb917e7c20255905f26518ac353ec",
                "md5": "8c1ac904009c282a8323051459fefe7b",
                "sha256": "f1739d71d7e89bc803fd153b051bbfe8408436284269a0a7c0d3071bf1f2b20a"
            },
            "downloads": -1,
            "filename": "screwhashesset-0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c1ac904009c282a8323051459fefe7b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13302,
            "upload_time": "2023-07-08T20:15:41",
            "upload_time_iso_8601": "2023-07-08T20:15:41.969909Z",
            "url": "https://files.pythonhosted.org/packages/f3/1d/cfbb9da804d8fdbd39467ffe28227f0eb917e7c20255905f26518ac353ec/screwhashesset-0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12c423eb394cba783fccb3c4fd356f26446ef6d15529465e461294ff1563ecaf",
                "md5": "cb4a7ff2dcdbdf5f6a1385eef5ecee42",
                "sha256": "8277a4ee6020a2add4f5fe73ad78f54a9c2d8a59f5d40e9c2bed001a68e0377e"
            },
            "downloads": -1,
            "filename": "screwhashesset-0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "cb4a7ff2dcdbdf5f6a1385eef5ecee42",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12866,
            "upload_time": "2023-07-08T20:15:44",
            "upload_time_iso_8601": "2023-07-08T20:15:44.411972Z",
            "url": "https://files.pythonhosted.org/packages/12/c4/23eb394cba783fccb3c4fd356f26446ef6d15529465e461294ff1563ecaf/screwhashesset-0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-08 20:15:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "screwhashesset",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "screwhashesset"
}
        
Elapsed time: 0.31943s