-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
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): |
Metadata
Metadata
Assignees
Labels
No labels