I need to inherit list class and override the init() method to take parameters a,b . a should be the lenght of the list I initialise and b should the step between Items in the list. I just don't know where to start with overriding the init method.
def myclass(list):
def __init__(a,b,*args, **kwargs):
pass
I have no idea what to do past this.
I have seen I can do this:
class MyClass(list):
def __init__(a,b):
data =[x for x in range(0,a*b,b)]
list.__init__(self,data)
But the I am not familiar with how python implements the list class, for instance how do I get to use the list comprehension I just passed.