Repository navigation
Write Ufunc_Nin0_Nout1 directly in the ufunc stub template - #353
Merged
avalentino merged 1 commit intoOct 9, 2026
Merged
Conversation
A good way to annotate ufuncs is to generate typing-only generic types for each `(nin,nout)` combination and to declare individual ufuncs as instances of those generic types with appropriate values for the type parameters. The ufuncs with `nout==1` have a usable `at()` method and their `__call__()` method signature is also somewhat different from ufuncs with `nout!=1`, so it will be useful to have `erfa_generator` create the generic ufunc subtypes from two separate templates. However, if a ufunc has `(nin,nout)==(0,1)` then its `__call__()` method is analogous to the other ufuncs with `nout==1`, but it nonetheless does not have a usable `at()` method. That means the corresponding generic ufunc subtype is the simplest to implement by writing it directly in the type stub template instead of having `erfa_generator` create it from a separate template.
avalentino
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A good way to annotate ufuncs is to generate typing-only generic types for each
(nin,nout)combination and to declare individual ufuncs as instances of those generic types with appropriate values for the type parameters. The ufuncs withnout==1have a usableat()method and their__call__()method signature is also somewhat different from ufuncs withnout!=1, so it will be useful to haveerfa_generatorcreate the generic ufunc subtypes from two separate templates. However, if a ufunc has(nin,nout)==(0,1)then its__call__()method is analogous to the other ufuncs withnout==1, but it nonetheless does not have a usableat()method. That means the corresponding generic ufunc subtype is the simplest to implement by writing it directly in the type stub template instead of havingerfa_generatorcreate it from a separate template.