Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27188
| Date | 2012-08-16 10:46 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: dbf.py API question concerning Index.index_search() |
| References | (1 earlier) <502c4439$0$29978$c3e8da3$5496439d@news.astraweb.com> <502C4B3A.6000603@stoneleaf.us> <502C591E.2060700@mrabarnett.plus.com> <502D1C27.5050108@stoneleaf.us> <502D2321.3040809@mrabarnett.plus.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3386.1345138884.4697.python-list@python.org> (permalink) |
MRAB wrote: > On 16/08/2012 17:13, Ethan Furman wrote: >> Currently there are: >> >> .index(data) --> returns index of data in Index, or raises error >> .query(string) --> brute force search, returns all matching records >> .search(match) --> binary search through table, returns all matching >> records >> >> 'index' and 'query' are supported by Tables, Lists, and Indexes; search >> (and now index_search) are only supported on Indexes. >> > What exactly is the difference between .index and .index_search with > the default arguments? .index requires a data structure that can be compared to a record (another record, a dictionary with the same field/key names, or a list/tuple with values in the same order as the fields). It returns the index or raises NotFoundError. It is brute force. .index_search requires match criteria (a tuple with the desired values in the same order as the key). It returns the index or raises NotFoundError (unless nearest is True -- then the value returned is where the match should be). It is binary search. So the only similarity is that they both return a number or raise NotFoundError. What they use for the search and how they perform the search are both completely different. ~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
dbf.py API question concerning Index.index_search() Ethan Furman <ethan@stoneleaf.us> - 2012-08-15 16:26 -0700
Re: dbf.py API question concerning Index.index_search() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-16 00:52 +0000
Re: dbf.py API question concerning Index.index_search() Ethan Furman <ethan@stoneleaf.us> - 2012-08-15 18:22 -0700
Re: dbf.py API question concerning Index.index_search() MRAB <python@mrabarnett.plus.com> - 2012-08-16 03:21 +0100
Re: dbf.py API question concerning Index.index_search() Ethan Furman <ethan@stoneleaf.us> - 2012-08-16 09:13 -0700
Re: dbf.py API question concerning Index.index_search() MRAB <python@mrabarnett.plus.com> - 2012-08-16 17:43 +0100
Re: dbf.py API question concerning Index.index_search() Ethan Furman <ethan@stoneleaf.us> - 2012-08-16 10:46 -0700
Re: dbf.py API question concerning Index.index_search() Hans Mulder <hansmu@xs4all.nl> - 2012-08-16 12:34 +0200
csiph-web