In response to the previous question , I had, I am now wondering if there is a way to make the following code more enjoyable:
class Cycle(list):
def insertextend(self, index, other, reverse = False):
"""Extend the cycle by inserting an iterable at the given position."""
index %= len(self)
if reverse:
super(Cycle, self).__init__(self[:index] + list(reversed(other)) + self[index:])
else:
super(Cycle, self).__init__(self[:index] + other + self[index:])
Any ideas on how I can remove super(Cycle, self).__init__(...)?
source
share