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


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

Re: subclassing collections.Counter

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2015-12-15 09:11 -0700
Last post2015-12-15 09:11 -0700
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: subclassing collections.Counter Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-15 09:11 -0700

#100468 — Re: subclassing collections.Counter

FromIan Kelly <ian.g.kelly@gmail.com>
Date2015-12-15 09:11 -0700
SubjectRe: subclassing collections.Counter
Message-ID<mailman.29.1450195938.22044.python-list@python.org>
On Tue, Dec 15, 2015 at 8:49 AM, Pavlos Parissis
<pavlos.parissis@gmail.com> wrote:
> Hi,
>
> I need to store values for metrics and return the average for some
> and the sum for the rest. Thus, I thought I could extend
> collections.Counter class by returning averages for some keys.

Leave Counter out of it, as this is not what it's designed for. Write
a custom Metrics class, with each attribute being a pseudo-collection
that maintains a sum or average.

[toc] | [standalone]


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


csiph-web