collections Flashcards

1
Q

test module

A

unittest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

run all tests

A

unittest.main()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

container protocol

A

__contains__(item)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

sized protocol

A

__len__()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

sequence protocol

A

__getitem__(slice_object); __reversed__() fallback to __getitem__() and len();index(item); count(item); __add__(); __mul__()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

default equality implementation

A

identity test like is

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

equality special method

A

__eq__(self, rhs)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

inequality special method

A

__ne__(self, rhs)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

when not implimented

A

return NotImplimented instead of raise NotImplimentedError

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Abstract Base Class collection

A

collections.abc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

algebraic set operations

A

__and__(), intersection(), &; __or__(), union(), | ; __xor__(), symmetric_difference(), ^;__sub__(), difference(), - ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly