Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AddedToPythonAs<T>()#2330

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
filmor merged 1 commit intopythonnet:masterfromlosttech:ToPythonAs
Feb 28, 2024
Merged

AddedToPythonAs<T>()#2330

filmor merged 1 commit intopythonnet:masterfromlosttech:ToPythonAs
Feb 28, 2024

Conversation

lostmsu
Copy link
Member

AddedToPythonAs<T>() extension method to allow for explicit conversion using a specific type

What does this implement/fix? Explain your changes.

The existingToPython() extension always uses current object type. There are scenarios though where objects have to be explicitly represented as their base types or interfaces. For example,42.ToPython() produces Pythonint, but there's currently no easy way from C# to pass42 asIConvertible so that Python could call theIConvertible members.

The new extension can be used for this purpose:42.ToPythonAs<IConvertible>() will return aPyObject that has allIConvertible members.

Does this close any currently open issues?

fixes#2311

Any other comments?

N/A

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Updated theCHANGELOG

@lostmsulostmsu mentioned this pull requestFeb 27, 2024
5 tasks
@filmorfilmor merged commit9d18a24 intopythonnet:masterFeb 28, 2024
@lostmsulostmsu deleted the ToPythonAs branchFebruary 28, 2024 21:47
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@filmorfilmorfilmor left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Allow setting typed objects via PyModule.Set
2 participants
@lostmsu@filmor

[8]ページ先頭

©2009-2025 Movatter.jp