Skip to content

Conversation

@OddCoincidence
Copy link
Contributor

The former required the addition of the NotImplemented constant to match cpython`s behavior.

@cthulahoops
Copy link
Collaborator

Can we test these using idiomatic python rather than calling the magic methods directly:

Eg:

assert abs(complex(3, 4)) == 5
assert complex(3, 4) == complex(3, 4)

etc?

@windelbouwman
Copy link
Contributor

@cthulahoops I agree, this is cleaner testcode. It will invoke the magic method at some point in time.

pub map_type: PyObjectRef,
pub memoryview_type: PyObjectRef,
pub none: PyObjectRef,
pub not_implemented: PyObjectRef,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, I cannot be believe we did not implement this yet ;)

@OddCoincidence OddCoincidence changed the title Add complex.{__eq__, __neg__} Add complex.{__abs__, __eq__, __neg__} Feb 9, 2019
@OddCoincidence
Copy link
Contributor Author

Thanks to @cthulahoops's suggestion, I think I found a subtle bug in the way the binary magic methods currently are implemented. Filed as #419. I will work around it here, and fix this in another PR.

@cthulahoops
Copy link
Collaborator

Looks ready to merge, but has conflicts to resolve.

@windelbouwman
Copy link
Contributor

I resolved the conflict.

@windelbouwman windelbouwman merged commit 03a2aad into RustPython:master Feb 10, 2019
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