title: How to prevent appending duplicates of class objects into Python lists?
body: <p>I am creating a sport team database which stores information about a sports team. One of the issues I have come across in one of my methods was inability to prevent the same object from appending into a list twice. I do not want the user adding the same information twice, but I am not entirely sure how to resolve this issue. </p>
  
  <p>I am working under Python Tkinter to create this program. </p>
  
  <pre><code>import tkinter as tk
  from tkinter import ttk
  from tkinter import messagebox
  
  
  allTeamlist = []
  
  
  
  class Team: 
  
   def __init__(self, team, coach):
     self.team = team
     self.coach = coach
     self.studentsinTeam = []
  
  
  class MainScreen:
   def __init__(self):
  
    self.mainscreen = tk.Tk()
    self.mainscreen.title("GUI")
    self.mainscreen.geometry("700x400")
  
  #####Team Buttons##########
    heading3 = tk.Label(self.mainscreen, text= "Team", foreground = "Red", font=("Arial", 10))
    heading3.pack()
  
    button6 = tk.Button(self.mainscreen, text = "Add New Team", command= self.ShowScreen6)
    button6.pack()
  
   def OpenWindow(self):
    tk.mainloop()
  
   def ShowScreen6(self):
    self.mainscreen.destroy()
    screen6 = AddTeamScreen()
  
  class AddTeamScreen:
  
   def __init__(self):
    self.Tscreen1 = tk.Tk()
    self.Tscreen1.title("Add Team")
    self.Tscreen1.geometry("700x400")
  
    self.getTeam = tk.StringVar()
    self.getCoach = tk.StringVar()
  
    self.teamlabel = tk.Label(self.Tscreen1, text = "Add a new Team")
    self.teamlabel.pack()
  
    self.teamentry = tk.Entry(self.Tscreen1, textvariable= self.getTeam)
    self.teamentry.pack()
  
    self.coachlabel = tk.Label(self.Tscreen1, text= "Coach")
    self.coachlabel.pack()
  
    self.coachentry = tk.Entry(self.Tscreen1, textvariable = self.getCoach)
    self.coachentry.pack()
  
    self.addbutton = tk.Button(self.Tscreen1, text = "Add Team", command = self.addingteammethod)
    self.addbutton.pack()
  
   def addingteammethod(self):
  
    addTeam = self.getTeam.get()
    addCoach = self.getCoach.get()
  
    newTeamtoAdd = Team(addTeam, addCoach)
  
    if newTeamtoAdd in allTeamlist: 
     messagebox.showerror("Error", "Exists")
  
    elif newTeamtoAdd not in allTeamlist:
     allTeamlist.append(newTeamtoAdd)
     messagebox.showinfo("SUCCESS", "ADDED")
     print(allTeamlist)
  
  mainscreen = MainScreen()
  mainscreen.OpenWindow()
  </code></pre>
  
  <p>I am new OOP and Tkinter programming so I am still learning! How do I prevent this occurance from happening?</p>