title: Constant lambda expressions, shape of return data
body: <p>A list of lambda expressions given to me (by <a href="http://docs.sympy.org/dev/modules/utilities/lambdify.html" rel="nofollow">Sympy's lambdify</a>), some explicitly depending on a variable <code>x</code>, some constant. I would like to evaluate those consistently with Numpy arrays.</p>
  
  <p>When evaluating a lambda expression, e.g., <code>lambda x: 1.0 + x**2</code>, with a Numpy array <code>x</code>, the result will have the same shape as the array. If the expression happens to not explicitly contain <code>x</code> though, e.g., <code>g = lambda x: 1.0</code>, only a scalar is returned.</p>
  
  <pre><code>import numpy
  
  f = [lambda x: 1.0 + x**2, lambda x: 1.0]
  
  X = numpy.array([1, 2, 3])
  
  print(f[0](X))
  print(f[1](X))
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>[  2.   5.  10.]
  1.0
  </code></pre>
  
  <p>Is there a way to get the shapes of the output arguments consistent?</p>