title: Confused about re.compile behaviour
body: <p>Please help me understand why the code in CODE2 is working. My understanding is that <code>re.compile</code> returns an object and we specify methods like <code>search</code>, <code>match</code>, <code>findall</code> etc to obtain the desired result.</p>
  
  <p>What I am confused about is how <code>re</code> module level functions like search is able to accept the compiled abject as the parameter. Please see CODE2</p>
  
  <p>CODE1:</p>
  
  <pre><code>In [430]: p = re.compile(r'(\b\w+)\s+\1')
  In [431]: p.search('Paris in the the spring').group()
  Out[431]:
  'the the'
  </code></pre>
  
  <p>CODE 2</p>
  
  <pre><code>In [432]: re.search(p, 'Paris in the the spring').group()
  Out[432]:
  'the the'
  </code></pre>