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


Groups > comp.lang.python > #73765 > unrolled thread

Re: Creating a dict-like class that counts successful and failed key matches

Started byChris Angelico <rosuav@gmail.com>
First post2014-07-01 08:08 +1000
Last post2014-07-01 08:08 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Creating a dict-like class that counts successful and failed key matches Chris Angelico <rosuav@gmail.com> - 2014-07-01 08:08 +1000

#73765 — Re: Creating a dict-like class that counts successful and failed key matches

FromChris Angelico <rosuav@gmail.com>
Date2014-07-01 08:08 +1000
SubjectRe: Creating a dict-like class that counts successful and failed key matches
Message-ID<mailman.11353.1404166116.18130.python-list@python.org>
On Tue, Jul 1, 2014 at 2:47 AM,  <python@bdurham.com> 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web