Exploring Functional Options in Python

2:40pm - 2:55pm on Friday, October 6

Rami Awar

Watch:
https://youtu.be/NzYxEF6623o

Description

Documenting lots of arguments well is hard. Validating each is even harder. Function arguments are not scalable past some point. Configuration structs are heavy, specially if every function expected it’s own config instance. Functional APIs solve this problem in their own awkward little way with a bit more code.

The first time I saw functional options in Golang, I didn’t fully understand why something as simple as configuring options (class or function args) looked so awkward. Then I read about the technique and realized that this solved a problem we have in every language, not just Golang.

Several years later, I found the chance to apply it when designing an API in Python and noticed no existing implementations! This talk is about adopting a very interesting API option design from Golang’s Rob Pike.

Want to edit this page?