forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
To make writing Rust functions that take Python arguments ergonomic, we need an easy way to describe how to parse arguments, and ideally convert to Rust object abstractions. The C API for argument parsing is described here: https://docs.python.org/3/c-api/arg.html
C code in CPython uses a DSL to pre-generate C argument parsing code called argument clinic
We have a few different ways we could go here. PyO3 currently uses proc-macros to provide very ergonomic argument parsing. We could also modify argument clinic to generate Rust code and include!() the generated files, which might have better compilation times.
I am still undecided about which approach I prefer.