From: Francesc A. <fa...@ca...> - 2005-01-31 19:38:45
|
A Dilluns 31 Gener 2005 19:21, Norbert Nemec va escriure: > > That sounds reasonable. What about making rows --> rowlist and > > columns --> columnlist? > > How about rowselect and colselect? Probably a matter of taste. 'list' is > fine with me as well. I still prefer rowlist and columnlist. Although selectrows and selectcolums might be nice as well. > OK, I agree that retrieving out of order is a killer. Still - if I give a > list of rows to read, I would expect the result to be ordered in the same > way. Maybe, the code could check whether the list is ordered and throw an > error otherwise? Checking, whether a list is sorted is relatively > inexpensive. > (OK, sorting an already sorted list is inexpensive as well, but still, I > don't like the idea of silently changing the order of rows in a request.) I see your point. Mmm, perhaps raising a warning in case the list is unordered would be better (in the end, this operation would be perfectly valid). > Alternatively, one could sort the list first and use the permutation of t= he > > rowselect,permutation =3D zip(sorted(zip(rowselect,range(len(rowselect))= ))) > result =3D read_rows(rowselect) > dummy,result =3D zip(sorted(zip(permutation,result))) > return result > > but that's probably overkill... No, numarray can do this very efficently for NumArray objects. The problem could be re-ordering the resulting RecArray, that can be a bit more inefficient, but in the long run, that maybe worth the effort for most of cases. Good idea! Cheers and good luck!, =2D-=20 >qo< Francesc Altet =A0 =A0 http://www.carabos.com/ V =A0V C=E1rabos Coop. V. =A0=A0Enjoy Data "" |