title: How to ensure list contains unique elements?
body: <p>I have a class containing a list of strings.  Say:</p>
  
  <pre><code>ClassName:
   - list_of_strings
  </code></pre>
  
  <p>I need to enforce that this list of strings contains unique elements.  Unfortunately, I can't change this list_of_strings to another type, like a set.  </p>
  
  <p>In the <code>addToList(str_to_add)</code> function, I want to guarantee string uniqueness.  How can I best do this?  Would it be practical to add the string being added to the list, convert to a set, then back to a list, and then reassign that to the object?</p>
  
  <p>Here's the method I need to update:</p>
  
  <pre><code>def addToList(self, str_to_add):
      self.list_of_strings.append(str_to_add)
  </code></pre>
  
  <p>Thanks!</p>