擅长:python、mysql、java
<p>为了清楚起见,<code>Distance</code>对象可以类似于数组。{1}把所有的对象都变成一个浪费的列表。相反,你可以</p>
<pre><code>>>> dists = Distance(np.arange(10), unit=u.kpc) # Note the use of a Numpy array
>>> dists
<Distance [ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.] kpc>
</code></pre>
<p>大多数其他代码应该将其识别为Numpy数组并相应地执行操作。如果不是的话,你总是可以做到的</p>
^{pr2}$
<p>得到一个以kpc表示的原始Numpy <code>ndarray</code>。不要使用多个<code>Distance</code>对象的列表。太浪费了!在</p>