title: Python: Automatically change string to set in .intersection() method of Set?
body: <p>I am new to Python (and have basic knowledge of Java) and learning it on my own at the moment by using the Head First Python, 2nd Edition book.</p>
  <p>In one of the examples in the book, it shows how the .intersection() method of Sets is used. It does so in the following way:</p>
  <pre><code>if __name__ == '__main__':
      def search_for_vowels(word: str) -&gt; set:
          &quot;&quot;&quot;Return any vowels found in supplied word.&quot;&quot;&quot;
          vowels = set('aeiou')
          return vowels.intersection(set(word))
  
      print(search_for_vowels('hitch-hiker'))
      print(search_for_vowels('sky'))
  </code></pre>
  <p>However, when I tried this on my own, I accidentally forgot the 'set' part in the above code (above the print statements), hence it became:</p>
  <pre><code>if __name__ == '__main__':
      def search_for_vowels(word: str) -&gt; set:
          &quot;&quot;&quot;Return any vowels found in supplied word.&quot;&quot;&quot;
          vowels = set('aeiou')
          return vowels.intersection(word)
  
      print(search_for_vowels('hitch-hiker'))
      print(search_for_vowels('sky'))
  </code></pre>
  <p>The code, however, did run without any problems and returned the correct output. This seems kind of strage to me, as I would be comparing a set to a string, and not a set to a set. My question therefore is: Does Python automatically convert a string to a set when performing the intersection() method of Set?</p>
  <p>Thanks in advance,
  David</p>