Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93906
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.05; 'matches': 0.07; 'type,': 0.07; 'api': 0.09; 'collections': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; '8bit%:32': 0.16; 'hashes': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:Mapping': 0.16; 'subject:key': 0.16; 'wrote:': 0.16; 'language': 0.19; '>>>': 0.20; 'algorithm': 0.20; 'keys': 0.22; 'lawrence': 0.22; 'examples': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'url:activestate': 0.29; "i'm": 0.30; "we're": 0.30; 'skip:_ 10': 0.32; 'implement': 0.32; 'language.': 0.32; 'class': 0.33; 'problem': 0.33; 'url:python': 0.33; 'url:code': 0.34; 'so,': 0.35; 'mapping': 0.35; 'asking': 0.35; 'according': 0.36; 'but': 0.36; 'instead': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'mark': 0.40; 'subject:with': 0.40; 'url:3': 0.60; 'different': 0.63; 'our': 0.64; 'skip:\xe2 10': 0.70; 'hoping': 0.77; '8bit%:16': 0.84; 'application?': 0.84; 'pythonistas,': 0.84; 'url:datamodel': 0.84; 'url:recipes': 0.84; 'ethan': 0.91; 'furman': 0.91; 'url:reference': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: Mapping, with sequence as key, wildcard and subsequence matching |
| Date | Thu, 16 Jul 2015 08:09:05 +0100 |
| 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> <85y4igtxoh.fsf@benfinney.id.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | host-92-22-86-251.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
| In-Reply-To | <85y4igtxoh.fsf@benfinney.id.au> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.565.1437030570.3674.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1437030570 news.xs4all.nl 2856 [2001:888:2000:d::a6]:37671 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:93906 |
Show key headers only | View raw
On 16/07/2015 07:37, Ben Finney wrote: > 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?”. > https://docs.python.org/3/reference/datamodel.html?emulating-container-types <quote> The collections module provides a MutableMapping abstract base class to help create those methods from a base set of __getitem__(), __setitem__(), __delitem__(), and keys() </quote> Hence https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping Hunting for examples got me to http://code.activestate.com/recipes/578096-a-mutablemapping-that-can-use-unhashable-objects-a/ so fingers crossed, I'm just hoping that we're going in the right direction. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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