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

Special forms for nb::typed #835

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

oremanj
Copy link
Contributor

@oremanj oremanj commented Dec 24, 2024

Add two special forms for nb::typed:

  • nb::typed<nb::object, T> and nb::typed<nb::handle, T> render as just T, instead of the nonsensical object[T] that they would be otherwise. This allows recapture of the pre-2.0 functionality of nb::typed where it entirely replaces (rather than augments) the type of an argument.
  • nb::typed<nb::callable, Sig> for some C++ function signature Sig produces an equivalent Python callable signature. For example, nb::typed<nb::callable, void(float, bool)> would become Callable[[int, float], None], which there is currently no way to express due to the nested brackets.

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.

1 participant