title: Recursive function with yield doesn't return anything
body: <p>I am trying to create a generator for permutation purpose. I know there are other ways to do that in Python but this is for something else. Unfortunately, I am not able to yield the values. Can you help?</p>
  
  <pre><code>def perm(s,p=0,ii=0):
      l=len(s)
      s=list(s)
      if(l==1):       
          print ''.join(s)
      elif((l-p)==2):
          yield ''.join(s)
          yield ''.join([''.join(s[:-2]),s[-1],s[-2]])
      else:
          for i in range(p,l):
              tmp=s[p]
              s[p]=s[i]
              s[i]=tmp        
              perm(s,p+1,ii)
  </code></pre>