Help me override append function of list object

jeremito jeremit0 at
Tue Jan 30 16:35:17 CET 2007

I have created a class that inherits from the list object.  I want to 
override the append function to allow my class to append several 
copies at the same time with one function call.  I want to do 
something like:

import copy

class MyList(list):

  def append(self, object, n=1):
    for i in xrange(n):

Now I know this doesn't work because I overwrite append, but want the 
original functionality of the list object.  Can someone help me?


More information about the Python-list mailing list