pyclass: unify pyclass with its pyo3 arguments #2234
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that the arguments to configure the
#[pyclass]
macro behaviour were split somewhat arbitrarily between#[pyclass(...)]
and#[pyo3(...)]
.This PR does some refactoring and unifies the two in a backwards-compatible way, by allowing both forms to take all options. One could describe the new rule as
#[pyclass(<stuff>)]
is just shorthand for#[pyclass] #[pyo3(<stuff>)]
.In the future I'd be quite keen for us to commit on a design one way or another and deprecate the other form. I think we have some time to muse on this.
I think I'd prefer to have
#[pyclass(<stuff>)]
and not need a separate#[pyo3(...)]
accompaniment at all, however I'm not completely sure on that; it might depend on how the#[pymodule]
macro evolves in #694.