Path: csiph.com!usenet.pasdenom.info!poup.poupinou.org!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; 'default.': 0.07; 'key.': 0.07; 'strings.': 0.07; 'though:': 0.07; 'length.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tuple': 0.09; 'value.': 0.15; '*only*': 0.16; 'arbitrarily': 0.16; 'mapping,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'sentinel': 0.16; 'subject:Mapping': 0.16; 'subject:key': 0.16; 'wrote:': 0.16; 'exists': 0.18; 'thanks.': 0.18; 'matching': 0.23; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; '(e.g.': 0.27; 'sequence': 0.27; 'specify': 0.27; "skip:' 10": 0.28; 'itself,': 0.29; 'position.': 0.30; 'items.': 0.33; 'text': 0.35; 'mapping': 0.35; 'should': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'data': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'our': 0.64; 'fall': 0.66; 'teach': 0.70; 'cultural': 0.76; '_o__)': 0.84; 'received:125': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Mapping, with sequence as key, wildcard and subsequence matching Date: Thu, 16 Jul 2015 15:55:15 +1000 References: <85k2u0vpis.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:ExOr5sjtuk1dYDb+EJUaM2lEJz8= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437026404 news.xs4all.nl 2887 [2001:888:2000:d::a6]:41610 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93898 Terry Reedy writes: > On 7/15/2015 9:51 PM, Ben Finney wrote: > > What well-defined data type exists with the following properties: > > > > * Mapping, key → value. > > > > * Each key is a sequence (e.g. `tuple`) of items such as text strings. > > > > * Items in a key may be the sentinel `ANY` value, which will match any > > value at that position. > > > > * A key may specify that it will match *only* sequences of the same > > length. > > > > * A key may specify that it will match sequences with arbitrarily many > > additional unspecified items. > > Every key should signal which of the last two alterntives holds. One > can be a default. The signal can be 'in-band', in the tuple key > itself, or 'out-of-band', not in the tuple key. Thanks. The part which puzzle me though: How do we teach the mapping type about that matching behaviour? -- \ “Without cultural sanction, most or all of our religious | `\ beliefs and rituals would fall into the domain of mental | _o__) disturbance.” —John F. Schumaker | Ben Finney