Created
November 6, 2023 20:33
-
-
Save mypy-play/beca56edcf56c561ebfb37147d31c2ed to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains 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
from typing import Optional | |
import numpy as np | |
import numpy.typing as npt | |
def f(a: Optional[npt.NDArray[np.int64]]): | |
if a is None: | |
a = np.repeat(1, 5).astype(np.int64) | |
print(a[0]) | |
print(max([0], key=lambda x: a[x])) | |
f(np.array([0], dtype=np.int64)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment