Skip to content

Conversation

jbrockmendel
Copy link
Member

No description provided.

new_i8s = np.concatenate([self[:loc].asi8, [item], self[loc:].asi8])
arr = type(self._data)._simple_new(new_i8s, dtype=self.dtype, freq=freq)
return type(self)._simple_new(arr, name=self.name)
return DatetimeIndexOpsMixin.insert(self, loc, item)
Copy link
Member

Choose a reason for hiding this comment

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

Would super().insert(loc, item) be better, more independent on the class name? Here and inPeriodIndex.

Copy link
Contributor

Choose a reason for hiding this comment

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

super() is non-idiomatic here because of the somewhat complex inheitance chain we have; meaning you have to really undertand the mro as a reader; this is simpler. We don't actualy use super() except in a few small cases (maybe should change those).

@jreback jreback added the Refactor Internal refactoring of code label Sep 18, 2020
@jreback jreback added this to the 1.2 milestone Sep 18, 2020
new_i8s = np.concatenate([self[:loc].asi8, [item], self[loc:].asi8])
arr = type(self._data)._simple_new(new_i8s, dtype=self.dtype, freq=freq)
return type(self)._simple_new(arr, name=self.name)
return DatetimeIndexOpsMixin.insert(self, loc, item)
Copy link
Contributor

Choose a reason for hiding this comment

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

super() is non-idiomatic here because of the somewhat complex inheitance chain we have; meaning you have to really undertand the mro as a reader; this is simpler. We don't actualy use super() except in a few small cases (maybe should change those).

@jreback jreback merged commit a0e0571 into pandas-dev:master Sep 18, 2020
@jbrockmendel jbrockmendel deleted the share-insert branch September 18, 2020 14:24
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants