#separator:tab
#html:true
#columns:Text	Back Extra	Tags
{{c1::collections.Counter}} counts hashable items; <code>most_common(n)</code> returns the top {{c2::n}} pairs.	Counter("banana").most_common(1) == [('a', 3)]	python collections
{{c1::collections.defaultdict}} calls its {{c2::default_factory}} for missing keys.	defaultdict(list)	python collections
{{c1::collections.deque}} supports O(1) appends and pops from {{c2::both ends}}.	deque(maxlen=3) drops old items	python collections
{{c1::functools.lru_cache}} memoizes a function; its size is set with {{c2::maxsize}}.	@lru_cache(maxsize=None)	python functools
{{c1::functools.partial}} freezes some {{c2::arguments}} of a callable.		python functools
{{c1::itertools.chain}} iterates several iterables {{c2::one after another}}.		python itertools
{{c1::itertools.groupby}} groups {{c2::consecutive}} items with equal keys, so sort first.		python itertools
{{c1::itertools.product}} gives the {{c2::Cartesian product}} of iterables.	product('ab', repeat=2)	python itertools
{{c1::pathlib.Path}} objects join paths with the {{c2::/}} operator.	Path.home() / "notes.txt"	python pathlib
{{c1::json.dumps}} serializes to a string; {{c2::json.dump}} writes to a file object.		python json
{{c1::datetime.timedelta}} represents a {{c2::duration}}.	timedelta(days=1, hours=2)	python datetime
{{c1::datetime.timezone.utc}} is the built-in {{c2::UTC}} tzinfo.		python datetime
{{c1::re.fullmatch}} succeeds only if the {{c2::whole string}} matches.		python re
Named groups are written {{c1::(?P&lt;name&gt;...)}} in the re module.		python re
{{c1::dataclasses.field}} with {{c2::default_factory}} avoids shared mutable defaults.	field(default_factory=list)	python dataclasses
{{c1::@dataclass(frozen=True)}} makes instances {{c2::immutable}} and hashable.		python dataclasses
{{c1::contextlib.contextmanager}} turns a {{c2::generator}} into a context manager.		python contextlib
{{c1::contextlib.suppress}} silently ignores the given {{c2::exceptions}}.	with suppress(FileNotFoundError): ...	python contextlib
{{c1::heapq.heappush}} and {{c2::heapq.heappop}} keep a list as a {{c3::min-heap}}.		python heapq
{{c1::bisect.bisect_left}} finds the insertion point in a {{c2::sorted}} list.		python bisect
{{c1::subprocess.run}} with {{c2::check=True}} raises CalledProcessError on failure.		python subprocess
{{c1::shutil.copytree}} copies a {{c2::directory tree}} recursively.		python shutil
{{c1::argparse}} parses command-line {{c2::arguments}} into a Namespace.		python argparse
{{c1::sqlite3.connect}} opens a database; {{c2::":memory:"}} creates an in-memory one.		python sqlite3
{{c1::enum.IntEnum}} members compare equal to {{c2::integers}}.		python enum
{{c1::statistics.median}} returns the {{c2::middle value}} of the data.		python statistics
