You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The simplest way to enjoy autocompletion for `Array`. This should be enough for most use cases.
78
+
79
+
- To make sure that the same type of array is returned (`ndarray`→`ndarray`, `Tensor`→`Tensor`), a `TypeVar` bound to `Array` can be used:
80
+
81
+
```python
82
+
def generic[TArray: Array](x: TArray) -> TArray:
83
+
return x +1
84
+
```
85
+
86
+
## Advanced Usage
75
87
76
88
### Namespace Type
77
89
78
-
You can test if an object matches the Protocol by:
90
+
You can test if an object matches the Protocol as they are [`runtime-checkable`](https://docs.python.org/3/library/typing.html#typing.runtime_checkable):
More complex example using [NewType](https://docs.python.org/3/library/typing.html#newtype) or [type aliases](https://docs.python.org/3/library/typing.html#type-aliases):
0 commit comments