title: Using numpy.vecotrize correctly
body: <p>I'm struggling with this code snippet using <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.vectorize.html" rel="nofollow noreferrer">np.vectorize</a></p>
  
  <pre><code>def to_homogenous(x):
  '''
  Convert a point x to homogenous coordinates.
  '''
  return np.hstack((x,np.array([1]))).flatten()
  
  vec_to_homo = np.vectorize(to_homogenous)
  coords = vec_to_homo([0,1])
  </code></pre>
  
  <p>This results in the following Error:</p>
  
  <blockquote>
    <p>ValueErrorTraceback (most recent call last)<br>
     in ()<br>
    ----> 1 coords1 = vec_to_homo([0,1])  </p>
    
    <p>/home/lib/python2.7/site-packages/numpy/lib/function_base.pyc in <strong>call</strong>(self, *args, **kwargs)<br>
       2753             vargs.extend([kwargs[_n] for _n in names])<br>
       2754<br>
    -> 2755         return self._vectorize_call(func=func, args=vargs)<br>
       2756<br>
       2757     def _get_ufunc_and_otypes(self, func, args):  </p>
    
    <p>/home/lib/python2.7/site-packages/numpy/lib/function_base.pyc in _vectorize_call(self, func, args)<br>
       2832<br>
       2833             if ufunc.nout == 1:<br>
    -> 2834                 res = array(outputs, copy=False, subok=True, dtype=otypes[0])<br>
       2835             else:<br>
       2836                 res = tuple([array(x, copy=False, subok=True, dtype=t)  </p>
    
    <p>ValueError: setting an array element with a sequence.  </p>
  </blockquote>
  
  <p>I understand the error message but I cannot for the life of me find how I should change my function/the call to vectorize to solve this problem.
  The function yields correct results if I pass only a single integer, i.e. <code>vec_to_homo(0)</code> yields <code>[0,1]</code>.</p>
  
  <p>My snippet is very close to the example provided in the documentation linked above, so I really don't get what is going wrong.</p>
  
  <p>Please help.<br>
  Thanks!</p>