 <p>I feel like the way you are doing it is not that dirty... But the <code>numpy.fill</code> function is a bit more tidy:</p> <pre><code>In [4]: import numpy as np In [5]: x=np.empty(5) In [6]: x.fill(8) In [7]: x Out[7]: array([ 8., 8., 8., 8., 8.]) </code></pre>