The code in Chapter 5 - lockedSet.py doesn't work propperly.
If you create a LockedSet object i.e.
z = LockedSet({1, 2, 3, 4})
and check if 2 is in z it will fail.
2 in z
returns
False
z.__contains__(2)
returns
None
The solution is to return the result of super(LockedSet, self).__contains__(elem)
def __contains__(self, elem):
with self._lock:`
return super(LockedSet, self).__contains__(elem)
|
def __contains__(self, elem): |
The code in Chapter 5 - lockedSet.py doesn't work propperly.
If you create a LockedSet object i.e.
z = LockedSet({1, 2, 3, 4})and check if 2 is in z it will fail.
2 in zreturns
Falsez.__contains__(2)returns
NoneThe solution is to return the result of
super(LockedSet, self).__contains__(elem)Learning-Concurrency-in-Python/Chapter 05/lockSet.py
Line 16 in cd3f31b