Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93903

Re: Mapping, with sequence as key, wildcard and subsequence matching

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Mapping, with sequence as key, wildcard and subsequence matching
Date 2015-07-16 16:37 +1000
References <mailman.552.1437011478.3674.python-list@python.org> <55a72c8b$0$1671$c3e8da3$5496439d@news.astraweb.com> <85fv4oveb2.fsf@benfinney.id.au> <55A74FAC.4090807@stoneleaf.us>
Newsgroups comp.lang.python
Message-ID <mailman.563.1437028680.3674.python-list@python.org> (permalink)

Show all headers | View raw


Ethan Furman <ethan@stoneleaf.us> writes:

> On 07/15/2015 10:53 PM, Ben Finney wrote:
> > Are those the ‘__contains__’, ‘__getitem__’ methods? What actually
> > is the API of a mapping type, that would need to be customised for
> > this application?
>
> The problem is that potential key matches are found by hashes

For the Python ‘dict’ type, yes. I already know that I don't want that
type, I want a custom mapping type which matches keys according to the
algorithm I specify.

So, I'm not asking “how do I make ‘dict’ do this?”. I am instead asking
“how do I implement a custom type which can duck-type for ‘dict’ but
have a different key-lookup implementation?”.

-- 
 \       “As the most participatory form of mass speech yet developed, |
  `\    the Internet deserves the highest protection from governmental |
_o__)                   intrusion.” —U.S. District Court Judge Dalzell |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Mapping, with sequence as key, wildcard and subsequence matching Ben Finney <ben+python@benfinney.id.au> - 2015-07-16 11:51 +1000
  Re: Mapping, with sequence as key, wildcard and subsequence matching Steven D'Aprano <steve@pearwood.info> - 2015-07-16 14:01 +1000
    Re: Mapping, with sequence as key, wildcard and subsequence matching Ben Finney <ben+python@benfinney.id.au> - 2015-07-16 15:53 +1000
    Re: Mapping, with sequence as key, wildcard and subsequence matching Ethan Furman <ethan@stoneleaf.us> - 2015-07-15 23:31 -0700
    Re: Mapping, with sequence as key, wildcard and subsequence matching Ben Finney <ben+python@benfinney.id.au> - 2015-07-16 16:37 +1000
    Re: Mapping, with sequence as key, wildcard and subsequence matching Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-16 08:09 +0100
    Re: Mapping, with sequence as key, wildcard and subsequence matching Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-16 08:24 +0100
  Re: Mapping, with sequence as key, wildcard and subsequence matching Marko Rauhamaa <marko@pacujo.net> - 2015-07-16 09:53 +0300

csiph-web