Incomplete sheet
This sheet is incomplete and could use some attention. Please submit code snippet suggestions as an issue or PR here.
Collections¶
For an overview of the abstract classes provided by the collections module, see here.
Code
import collections
Test¶
| Action | Code | Details |
|---|---|---|
| Is collection |
|
e.g., str, tuple, list, set, dict |
| Is sequence (defined ordering of elements) |
|
e.g., str, tuple, list |
| Is mapping |
|
e.g., dict |
| Is set |
|
e.g., set |