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

Implement __sub__/__rsub__.#188

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
windelbouwman merged 3 commits intomasterfromsub
Nov 6, 2018
Merged

Implement __sub__/__rsub__.#188

windelbouwman merged 3 commits intomasterfromsub
Nov 6, 2018

Conversation

@cthulahoops
Copy link
Collaborator

Example of how to call attrs that exist.

@@ -0,0 +1,21 @@
assert5-3==2

classComplex():
Copy link
Contributor

Choose a reason for hiding this comment

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

Notecomplex builtin type is also present, no issue here though.

def__repr__(self):
return"Com"+str((self.real,self.imag))

def__sub__(self,other):
Copy link
Contributor

Choose a reason for hiding this comment

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

Good check! Here lies the proof of the pudding indeed!

vm/src/vm.rs Outdated
} else if b.has_attr("__rsub__") {
self.call_method(&b, "__rsub__", vec![a])
ifletOk(method) =self.get_method(a.clone(),"__sub__"){
self.invoke(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can add ainvoke_with_args method which is less vebose.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@windelbouwmanwindelbouwmanwindelbouwman 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.

3 participants

@cthulahoops@windelbouwman

[8]ページ先頭

©2009-2025 Movatter.jp