Skip to content

CLN: remove unused from MultiIndex #32030

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 5 commits into from
Feb 18, 2020
Merged

Conversation

jbrockmendel
Copy link
Member

No description provided.

@simonjayhawkins
Copy link
Member

looks like mypy is against you here. not sure why. out of curiosity, why do need to use __new__ for MultiIndex?

@jbrockmendel
Copy link
Member Author

out of curiosity, why do need to use new for MultiIndex?

I think it is a combination of playing nicely with _simple_new and precedent set by Index.__new__

@WillAyd
Copy link
Member

WillAyd commented Feb 16, 2020

I think can just add a definition for sortorder at the class level to fix mypy

@simonjayhawkins
Copy link
Member

I think can just add a definition for sortorder at the class level to fix mypy

can you clarify why this is acceptable and #31716 (comment) is not.

in both cases making mypy aware of attributes. In the unacceptable case the attribute is added dynamically and therefore cannot be statically checked. Here, the attribute could be picked up by a static check if the initialazation was in __init__ instead of __new__

to me, it would seem that the other scenario should be more acceptable.

@jreback jreback added this to the 1.1 milestone Feb 17, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm. i think @simonjayhawkins has a comment; those the construction methods we have already use __new__, not likely to change as we have certain contruction requirements

@simonjayhawkins
Copy link
Member

lgtm. i think @simonjayhawkins has a comment; those the construction methods we have already use __new__, not likely to change as we have certain contruction requirements

yeah, happy with what is done here. the query was directed towards @WillAyd

@WillAyd
Copy link
Member

WillAyd commented Feb 18, 2020

can you clarify why this is acceptable and #31716 (comment) is not.

Yea as you mention the other one is factory generated and picks an arbitrary subset of methods to apply, so would either keep copying all attributes or stick with a weird in between. The inheritance here is much simpler and self-contained

@WillAyd WillAyd merged commit 9c06b30 into pandas-dev:master Feb 18, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 18, 2020

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the cln-mi branch February 18, 2020 15:30
roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants