> For the complete documentation index, see [llms.txt](https://memogarcia.gitbook.io/continuous-learning/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://memogarcia.gitbook.io/continuous-learning/tech/development/python.md).

# 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
