Lexicographical sort for numarray

Robert Kern rkern at ucsd.edu
Wed Apr 27 17:04:18 EDT 2005


Jason Mobarak wrote:
> import numarray as na
> import random
> 
> # example array
> arr = range(100)
> random.shuffle(arr)
> arr = na.array(arr)
> arr = na.reshape(arr, (10,10))
> 
> print arr # not rowsort'ed
> 
> arr.flat.sort() # key line
> 
> print arr # rowsort'ed

That's definitely not a lexicographic sort.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list