Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'explicit': 0.07; 'override': 0.09; 'cc:addr:python-list': 0.11; '(via': 0.16; '__getitem__,': 0.16; 'dict': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'method;': 0.16; 'subject:class': 0.16; 'subject:failed': 0.16; 'subject:key': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'subject:like': 0.24; 'cc:2**0': 0.24; 'pass': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'subject:that': 0.31; 'something': 0.35; 'received:google.com': 0.35; "he's": 0.36; 'method': 0.36; 'behind': 0.37; 'sure': 0.39; 'called': 0.40; "you're": 0.61; 'jul': 0.74; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=zwNHJJPD97I81EdteyHxvhhw8gYt4Ghud7t6etUqLTk=; b=KLYDTZ4TgSKHMaPGbokgLKnjlm5v2IsBVzCg6DW0eJ1eNe5LhE3QodpPfjNAKQhyYl olWF+jyxX9sXZbMG3hPTHZXKojMDmZ6x/siKMo0eRgf5RbqMac3u2VbW0LOJjrDUUvYr Kt5tIEvZ3J9hbDJsKVCUo+hTt5ZyzoC2+R418JM/RGjWxqiylB8z5U6b6FkWZcpgdyYJ M/aU7dPrQDkH0ga2+afavW1vAW2Zg+CcqbB5IWEQz/a8VJuLmMs411NyCTpmc6bXROGO mM2CAU103yq1qgW5Ij7hT5eAZlt4E9Fuh1YCJwLYDPz7xG46Jo3k9fvjZ/Eneod9mouR dVtQ== MIME-Version: 1.0 X-Received: by 10.58.243.1 with SMTP id wu1mr41592893vec.27.1404166107630; Mon, 30 Jun 2014 15:08:27 -0700 (PDT) In-Reply-To: <1404146834.28955.136173757.51576D44@webmail.messagingengine.com> References: <1404135829.10485.136092537.2F0486D2@webmail.messagingengine.com> <1404139465.27658.136120269.0CA38211@webmail.messagingengine.com> <53B18398.4090302@stoneleaf.us> <1404146834.28955.136173757.51576D44@webmail.messagingengine.com> Date: Tue, 1 Jul 2014 08:08:27 +1000 Subject: Re: Creating a dict-like class that counts successful and failed key matches From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404166116 news.xs4all.nl 2948 [2001:888:2000:d::a6]:56838 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73765 On Tue, Jul 1, 2014 at 2:47 AM, wrote: > I'm not sure I understand. Are you saying that Chris's __getitem__ will > not be called by other dict methods that would normally call this magic > method and instead call the parent's __getitem__ directly (via super() > or something similar?)? He's pointing out the general principle behind what I said about the .get() method; if you don't override .get() with your own implementation, it won't pass the request through your __getitem__, so it won't be statistically analyzed. That might be a good thing; it means you're going to have to be explicit about what gets counted. ChrisA