I am seeing some very strange behavior searching a unicode array. The attached code outputs the following: UNICODE Is sorted: True Search sorted by iteration, left: [0, 1, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 13] Search sorted by iteration, right: [0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 13] Search sorted by indexing, left: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13] Search sorted by indexing, right: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13] Search sorted by indexing with copy, left: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13] Search sorted by indexing with copy, right: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13]
If I remove the first print, it produces: Is sorted: True Search sorted by iteration, left: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] Search sorted by iteration, right: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] Search sorted by indexing, left: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13] Search sorted by indexing, right: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13] Search sorted by indexing with copy, left: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] Search sorted by indexing with copy, right: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] Neither answer is correct, since left and right should be offset by 1 when searching for an element in the array, by my reading of the docs. This is numpy 1.6.1 on OSX 10.6, python 2.7 Am I missing something? Thanks, Ray Jones
unicode_searchsorted.py
Description: Binary data
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion