Skip to content

ENH: Add annotations for bitwise operations - #17465

Merged
charris merged 3 commits into
numpy:masterfrom
BvB93:bitwise-ops
Oct 9, 2020
Merged

charris merged 3 commits into
numpy:masterfrom
BvB93:bitwise-ops

Conversation

@BvB93

@BvB93 BvB93 commented Oct 6, 2020

Copy link
Copy Markdown
Member

This pull requests adds annotations for ndarray and generic bitwise operations:

  • __invert__
  • __lshift__
  • __rshift__
  • __and__
  • __or__
  • __xor__

Unfortunately the likes of `self: uint64` don't work with protocols.

Revisit this once we add proper support for numerical precision.

@mattip mattip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread numpy/typing/_callable.py
Comment on lines +116 to +118
# TODO: The likes of `uint64 | np.signedinteger` will fail as there
# is no signed integer type large enough to hold a `uint64`
# See https://github.com/numpy/numpy/issues/2524

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment seems misplaced to me, it applies to the second overload only.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is correct. Inserting a comment between two overloads looks visually rather bad though, hence why it is on top.

@charris
charris merged commit 0cefa59 into numpy:master Oct 9, 2020
@BvB93
BvB93 deleted the bitwise-ops branch October 14, 2020 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants