Skip to content

TYP: overload asarray_tuplesafe signature #46966

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

Merged
merged 1 commit into from
May 9, 2022

Conversation

iasoon
Copy link
Contributor

@iasoon iasoon commented May 7, 2022

xref #37715

@iasoon iasoon force-pushed the typing/asarray_tuplesafe branch 2 times, most recently from 77f53d3 to 735ee3b Compare May 7, 2022 20:20
def asarray_tuplesafe(values, dtype: NpDtype | None = None) -> np.ndarray:
@overload
def asarray_tuplesafe(
values: ArrayLike | list | tuple | zip, dtype: NpDtype | None = ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively to special-casing, we could omit zip here and have the caller convert the argument to a list first, instead of having this function do the conversion (currently there is one call site using zip).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with having zip here.

@twoertwein twoertwein added the Typing type annotations, mypy/pyright type checking label May 8, 2022
@jreback jreback added this to the 1.5 milestone May 9, 2022
@jreback jreback merged commit b7d72f6 into pandas-dev:main May 9, 2022
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants