Skip to content

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Apr 28, 2019

Continuation from #26177. In addition to the uses of super dealt with in #26177, there were some more advanced uses of super in the code base, e.g. in classmethods and using super to jump to a specific point in the MRO-chain.

This PR specifically deals with:

  • super(..., self) in pyx-files
  • super(..., cls) in the whole code base
  • Changes some specific uses of super, se comments .

@pep8speaks
Copy link

pep8speaks commented Apr 28, 2019

Hello @topper-123! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-04-28 07:40:11 UTC


def isoformat(self, sep='T'):
base = super(_Timestamp, self).isoformat(sep=sep)
base = super().isoformat(sep=sep)
Copy link
Contributor Author

@topper-123 topper-123 Apr 28, 2019

Choose a reason for hiding this comment

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

This changes the first parameter in super to implivitly be TimeStamp rather than _Timestamp, which is ok in this case.

# We want PandasObject.__repr__, which dispatches to __unicode__
return super(ExtensionArray, self).__repr__()
# We want to bypass ExtensionArray.__repr__.
return str(self)
Copy link
Contributor Author

@topper-123 topper-123 Apr 28, 2019

Choose a reason for hiding this comment

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

This ends up in both master and this PR to call self.__unicode__. __unicode__ isn't needed anymore so should be cleaned up in a future PR.

# only result
result, how = (super(DataFrame, self.T)
._aggregate(arg, *args, **kwargs))
result, how = self.T._aggregate(arg, *args, axis=0, **kwargs)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is clearer to read than the super version.

if axis == 1:
return super(DataFrame, self.T).transform(func, *args, **kwargs).T
return self.T.transform(func, *args, axis=0, **kwargs).T
return super().transform(func, *args, **kwargs)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is clearer to read than the super version.

@topper-123 topper-123 closed this Apr 28, 2019
@topper-123 topper-123 deleted the clean_super_II branch May 1, 2019 20:03
@topper-123 topper-123 restored the clean_super_II branch May 1, 2019 20:05
@topper-123 topper-123 deleted the clean_super_II branch May 1, 2019 20:07
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

Successfully merging this pull request may close these issues.

2 participants