[Python-ideas] fancy indexing
Sturla Molden
sturla at molden.no
Tue Jul 20 22:07:21 CEST 2010
> Den 20.07.2010 20:16, skrev Guido van Rossum:
> Yes, it is roughtly like a WHERE statement in SQL or Fortran 90, or
> Python's built-in "filter" function (albeit more flexible).
Fancy indexing is actually more like a join. Since the result from a
numpy.where one array can be used to filter another array, it fancy
indexing would be like a join between tables in a relational database.
def join(blist, index):
return [blist[i] for i in index]
The big difference between fancy indexing and a join method is of course
that indexing can appear on the left side of an expression.
Sturla
More information about the Python-ideas
mailing list