title: Big O Notation of a module nested in a built-in method in Python
body: <p>I'm wondering about a rationale for determining the big O values behind built-in methods in Python. Given the following operation:</p>
  
  <pre><code>i_arr = ['1','2','5','3','4','5','5']
  
  s_arr = sorted(set(i_arr))
  </code></pre>
  
  <p>My rationale is that this is <code>sorted(set) = n^2</code> meaning two nested loops.</p>
  
  <p>Based on advice I dug into the higher level modules as part of my original function in the Python source code:</p>
  
  <pre><code> def sorted(lst):
          l = list(lst)
          l.sort()
          return l
  
  def sort(self):
          sortable_files = sorted(map(os.path.split, self.files))
  
  def set(self):
          if not self._value:
              self._value = True
  
              for fut in self._waiters:
                  if not fut.done():
                      fut.set_result(True)
  </code></pre>
  
  <p>Now I'm really confused :)</p>