collections Flashcards
1
Q
test module
A
unittest
2
Q
run all tests
A
unittest.main()
3
Q
container protocol
A
__contains__(item)
4
Q
sized protocol
A
__len__()
5
Q
sequence protocol
A
__getitem__(slice_object); __reversed__() fallback to __getitem__() and len();index(item); count(item); __add__(); __mul__()
6
Q
default equality implementation
A
identity test like is
7
Q
equality special method
A
__eq__(self, rhs)
8
Q
inequality special method
A
__ne__(self, rhs)
9
Q
when not implimented
A
return NotImplimented instead of raise NotImplimentedError
10
Q
Abstract Base Class collection
A
collections.abc
11
Q
algebraic set operations
A
__and__(), intersection(), &; __or__(), union(), | ; __xor__(), symmetric_difference(), ^;__sub__(), difference(), - ;