On 1/20/11 1:36 PM, Jake Biesinger wrote:
Thanks for the great suggestions!

On a related note, is there no way to efficiently sort a python array?

No.

x = array('f', xrange(10000000))
x.sort()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/wbiesing/src/python-sort/<ipython console>  in<module>()

AttributeError: 'array.array' object has no attribute 'sort'

type(sorted(x))
<type 'list'>

Seems like a common enough task, but no way to do it efficiently without 
scipy/numpy.

It's not really common. The array module is mostly used for data accumulation and interchange. Most people who need to compute things over efficiently-implemented homogeneous arrays use numpy.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to