-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Labels
Tracking IssueTracking issue.Tracking issue.
Milestone
Description
Some issues with type annotations that were brought up by @BvB93 at numpy/numpy#18585
- For
asarray, it isn't clear how to defineNestedSequence(typingannotations don't support recursive types). -
asarrayneeds to also includearrayas a valid type forobj(arrayshould not be considred a subtype ofNestedSequence) - The pipe operator for types isn't valid yet (https://www.python.org/dev/peps/pep-0604/) (it's used in the
NestedSequencetype inasarray) - For
stackandconcat, the type forarraysshould beTuple[array, ...]instead ofTuple[array] - For
stackandconcat(and possibly others),Tupleis too restrictive vs.Sequence. -
uniquecan be implemented as an@overload(see ENH: Implementation of the NEP 47 (adopting the array API standard) numpy/numpy#18585 (comment)). I don't know if this needs to be changed in the spec. - The return type for
finfoasfinfodoesn't make sense iffinfois a function (see ENH: Implementation of the NEP 47 (adopting the array API standard) numpy/numpy#18585 (comment)). -
__getitem__and__setitem__should include theellipsistype (ENH: Implementation of the NEP 47 (adopting the array API standard) numpy/numpy#18585 (comment)) -
(update:__len__should returnint__len__is slated for removal from the spec; see Specify shape behavior #289) - The return type for
shapeis currentlyUnion[ Tuple[ int, …], <shape> ], which needs to be addressed (there is a TODO in the spec for this). (update: see Specify shape behavior #289) -
Some of the other types for properties also use<...>types. We should make all the type annotations be valid Python/mypy that can be used in the annotations in the signature. -
Should the array object subclass fromtyping.Protocol(ENH: Implementation of the NEP 47 (adopting the array API standard) numpy/numpy#18585 (comment))? (I don't know if this is relevant for the spec). - The dunder methods (
__add__, and so on) should includeint,float, (andboolas appropriate) as allowed types forother.
Metadata
Metadata
Assignees
Labels
Tracking IssueTracking issue.Tracking issue.