Efficient python 2-d arrays?

Jake Biesinger jake.biesinger at gmail.com
Thu Jan 20 14:36:35 EST 2011


> Thanks for the great suggestions!

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


>>> 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.



More information about the Python-list mailing list