title: Python UserList module
body: <p>I'm new to Python. I'm thinking to use a class named Ulist to override the <strong>add</strong>, append, and extend methods, so that duplicate values will not be added to the list by any of these operations. Below is my code. But the problem is that when i tried to print out mylist, the result is an empty list. Can you help let me know which part of my code is wrong? Thanks!</p>
  
  <pre><code>class Ulist(UserList):
      def __init__(self, data):
          UserList.__init__(self)
          self.list = data
  
      def __add__(self, newdata):
          for i in newdata:
              if i in self.list:
                  print (i, "not be added to the list")
              else:
                  self.list += [i]
          return self.list
  
      def append(self,newdata):
          for i in newdata:
              if i in self.list:
                   print (i, "not be added to the list")
              else:
                  self.list.append(i)
          return self.list
  
      def extend(self,newdata):
           for i in newdata:
              if i in self.list:
                    print (i, "not be added to the list")
              else:
                  self.list.extend(i)
           return self.list
  
  mylist = Ulist([1,2,3])
  
  mylist.__add__([1,2])
  print (mylist)
  </code></pre>