94 cards across 6 sections
batteries-included
pip
numpy
pandas
typing
torch
t"..."
annotationlib
concurrent.interpreters
compression.zstd
[]
{}
''
0
0.0
None
False
'False'
f'{value!r:>10}'
!r
!s
format()
a, b = b, a
first, *rest = items
:=
if (n := len(data)) > 10:
match
case
if
0 <= x < 10
and
b = a
b
a
is
==
__eq__
True
list
dict
set
tuple
str
frozenset
copy.copy()
copy.deepcopy()
__repr__
__hash__
__len__
len()
__slots__ = ('x', 'y')
__dict__
def f(items=[])
*args
**kwargs
nonlocal
@lru_cache
def decorator(fn): ...
functools.lru_cache
partial
wraps
lambda x: x * 2
key=
sorted()
min()
max()
/
*
__init__
@dataclass
frozen=True
@property
@x.setter
with
__enter__
__exit__
@contextlib.contextmanager
yield
ExitStack
abc.ABC
@abstractmethod
TypeError
ClassName.__mro__
[x*2 for x in nums if x > 0]
(x*2 for x in nums)
__iter__
__next__
StopIteration
for
itertools.chain
groupby
islice
product
yield from subgen()
def add(a: int, b: int) -> int:
list[int]
dict[str, int]
int | None
Optional[int]
mypy
pyright
typing.Protocol
TypedDict
pyproject.toml
setup.py
setup.cfg
python -m venv .venv
site-packages
async def
await
asyncio.run(main())
asyncio.create_task()
asyncio.gather(*tasks)
threading
multiprocessing
test_*
assert
fixture
enumerate(items)
range(len(items))
for i, item in enumerate(items): print(i, item)
d1 | d2
d2
{**d1, **d2}
update()
merged = defaults | overrides
d.get(key, default)
KeyError
collections.defaultdict
count = defaultdict(int)count[word] += 1
_
1_000_000
price = 1_250_000mask = 0b1010_0101
first, *middle, last = items
first, *middle, last = [1, 2, 3, 4, 5]
pathlib.Path
.exists()
.read_text()
.glob()
os.path
from pathlib import Pathp = Path('data') / 'input.csv'text = p.read_text()
with open(...) as f:
with open('log.txt') as f: lines = f.readlines()
copy.deepcopy(obj)
list(obj)
dict(obj)
import copysafe = copy.deepcopy(nested)
@functools.lru_cache(maxsize=None)
@lru_cache(maxsize=None)def fib(n): return n if n < 2 else fib(n-1) + fib(n-2)
''.join(parts)
+=
result = ', '.join(str(x) for x in items)
@pytest.mark.parametrize
@pytest.mark.parametrize('n,exp', [(1,1),(2,4)])def test_sq(n, exp): assert n * n == exp
Exception
except:
KeyboardInterrupt
try: value = int(raw)except ValueError: value = 0
@dataclass(frozen=True)
FrozenInstanceError
@dataclass(frozen=True)class Point: x: int y: int
asyncio.gather()
results = await asyncio.gather( fetch(url1), fetch(url2))
class Sized(Protocol): def __len__(self) -> int: ...
items=[]
def f(items=None): items = items if items is not None else []
x is None
[x for x in seq]
(x for x in seq)
func(*args, **kwargs)
@decorator
def
func = decorator(func)
functools.wraps
__name__
__doc__
with obj:
try/finally
field(default_factory=list)
asyncio
test_*.py
*_test.py
test_
Test
items = items if items is not None else []
except Exception:
for x in list(items)
0.1 + 0.2 == 0.3
math.isclose(a, b)
id
type
items
open()
close()
with open(path) as f:
list(original)
dict(original)
time.sleep()
requests.get()
asyncio.sleep()
asyncio.to_thread()
from module import thing
import module
math.isclose()
asyncio.sleep
isinstance(x, SomeClass)
list(items)