Skip to content

Conversation

@daemontus
Copy link
Contributor

@daemontus daemontus commented Oct 26, 2023

This PR is based on the discussion for this question. It just adds a single method into the inheritance section of the class guide.

The purpose of this new example is to show how a sub-type can be instantiated dynamically within a method other than #[new]. In other words, how to "instantiate" PyClassInitializer into an actual Python object from Rust.

If you know a better way to do this, feel free to suggest an alternative example. But the reactions in the question discussion seem to indicate that the answer is not entirely obvious, hence I considered it worth including.

@daemontus daemontus marked this pull request as draft October 26, 2023 21:57
Co-authored-by: Bruno Kolenbrander <[email protected]>
@daemontus
Copy link
Contributor Author

daemontus commented Oct 26, 2023 via email

@daemontus daemontus marked this pull request as ready for review October 27, 2023 01:58
@daemontus daemontus requested a review from mejrs October 27, 2023 12:44
Copy link
Member

@mejrs mejrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@adamreichold adamreichold added this pull request to the merge queue Oct 27, 2023
Merged via the queue into PyO3:main with commit dc251d0 Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants