Skip to content
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

Support properties with differently typed getter and setter pairs #1735

Closed
Azureblade3808 opened this issue Aug 27, 2021 · 2 comments
Closed

Comments

@Azureblade3808
Copy link

Sample:

from pandas import DataFrame

df = DataFrame([[1, 2, 3]])
df.columns = ["A", "B", "C"]

columns = df.columns  # Typed as "list[str]" instead of "Index".

There are many properties in Pandas which have differently typed getter and setter pairs, like "pandas.DataFrame.columns" here. I do believe that it takes "Iterable[Any]" as the setter argument, which is even wider than the "Union[List[_str], Index[_str]]" declared in the stubs.

I don't think there is guarantee that the result of a property getter would have the same type as the value previously set to the property. Maybe the getter type can be respected?

@erictraut
Copy link
Contributor

This is related to this issue, which we decided not to address at the time.

@Azureblade3808
Copy link
Author

I see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants