# Python

## Advanced

https://realpython.com/tutorials/advanced/

## Memory profiles

https://github.com/bloomberg/memray

## pypy

```
sudo add-apt-repository ppa:pypy/ppa
sudo apt update
sudo apt install -y pypy3 pypy3-venv
```

* [pypy](https://www.pypy.org/)

Avoid calling functions in hot loops (for performance)

## ORM

* Pony
* Tortoise (async)

## Core Python

### Dataclasses

```python
from dataclassses import dataclass, field

@dataclass(frozen=True, order=True)
class Comment:
    id: int
    text: str
    replies: list[int] = field(default_factory=list)
```

### Inspect

```python
import inspect

print(inspect.getmembers(THE_CLASS, inspect.isfunction))
```

### dis
