Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend guide section on classes regarding free functions #3243

Merged
merged 2 commits into from
Jun 16, 2023

Conversation

adamreichold
Copy link
Member

@adamreichold adamreichold commented Jun 15, 2023

It might not be obvious from the reading the sections on free functions and on classes that they combine in a frictionless manner, i.e. class instances can be parameters to free functions in the same manner that the self parameters of instance methods are handled.

This also explicitly calls out the interaction between Clone and FromPyObject for classes.

Closes #1059

cc @facundo-villa

@adamreichold adamreichold added the CI-skip-changelog Skip checking changelog entry label Jun 15, 2023
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Thanks for adding this section! It's actually been on my mind for a long time, see #1059. I just never got around to writing anything 🙈. Do you think this PR closes that issue?

guide/src/class.md Outdated Show resolved Hide resolved
guide/src/class.md Show resolved Hide resolved
It might not be obvious from the reading the sections on free functions and on
classes that they combine in a frictionless manner, i.e. class instances can be
parameters to free functions in the same manner that the self parameters of
instance methods are handled.

This also explicitly calls out the interaction between `Clone` and
`FromPyObject` for classes.
@adamreichold
Copy link
Member Author

Do you think this PR closes that issue?

I added taking &PyCell<T> to the examples and think that with this addition, it does indeed.

@adamreichold adamreichold force-pushed the classes-and-free-functions branch from 7a0b6d2 to 4470a1f Compare June 16, 2023 06:45
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Looks great! Just caught a typo and a quick thought on the section heading. Feel free to merge this once those are resolved 👍

guide/src/class.md Outdated Show resolved Hide resolved
guide/src/class.md Outdated Show resolved Hide resolved
guide/src/python_from_rust.md Show resolved Hide resolved
@adamreichold adamreichold force-pushed the classes-and-free-functions branch from 4470a1f to 684002d Compare June 16, 2023 10:46
@adamreichold adamreichold enabled auto-merge June 16, 2023 10:46
@adamreichold adamreichold added this pull request to the merge queue Jun 16, 2023
Merged via the queue into main with commit 5b85c92 Jun 16, 2023
@adamreichold adamreichold deleted the classes-and-free-functions branch June 18, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-skip-changelog Skip checking changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document passing PyClass values as arguments
2 participants