Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2.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.105 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.00; 'python': 0.11; 'cs,': 0.16; 'fine.': 0.16; 'heap,': 0.16; 'implies': 0.16; 'overloaded': 0.16; 'repetition': 0.16; 'set,': 0.16; 'weird': 0.16; 'wrote:': 0.18; 'programming': 0.22; 'email addr:gmail.com>': 0.22; 'stick': 0.24; "i've": 0.25; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'sets': 0.30; 'message-id:@mail.gmail.com': 0.30; 'that.': 0.31; 'fine,': 0.31; 'lists': 0.32; 'compatible': 0.32; 'not.': 0.33; 'except': 0.35; 'case,': 0.35; 'received:google.com': 0.35; 'detail': 0.37; 'being': 0.38; 'sometimes': 0.38; 'skip:& 10': 0.38; 'nov': 0.38; 'to:addr :python-list': 0.38; 'list,': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'liked': 0.60; 'hardware': 0.61; 'name': 0.63; 'term': 0.63; 'skip:n 10': 0.64; 'world': 0.66; 'design.': 0.68; 'bag': 0.74; 'bags': 0.84; 'describes': 0.84; 'studying': 0.84 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:to :content-type; bh=2WWxKF16/QTXtTS9WiJq0Ft+MTwOzjkrE9EugBPYVys=; b=BmAEbzDCAo22envBX1m/y1XHUi6PaUtFdhrCowbpRd4bEkPfXDPsVzp42wl1sBsM6W ZlMhjM5XEOehi4XH/Mmf4H6r7zzkQeOlDLy1yGFbBxNPpbh/J5BbkUIkPFUD20/Ccf6B XajgAigeYLo5HR4JjcxaFCMH/mjXSKL5Ngxp/KCnpNZl23xDQ1III7FpkHENTEkzMex5 wSFvcWVuk09c5hUzlXJjtgMQG/FSYGo2ParkDFQqmfShniw43oME2s820lXqBJ+sNN23 i2V0xIASCXW0xmohS9zK28wdkoBzqtgaokIM4nEbAKbCmR/b6S4koQpPoPzd3mAkJyLy C+2A== MIME-Version: 1.0 X-Received: by 10.68.111.161 with SMTP id ij1mr5410048pbb.10.1415289080663; Thu, 06 Nov 2014 07:51:20 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Nov 2014 08:51:20 -0700 Subject: Re: Real-world use of Counter From: Ian Kelly To: Python Content-Type: multipart/alternative; boundary=047d7b5db7fae856d6050732aa0e 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: 67 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415290928 news.xs4all.nl 2877 [2001:888:2000:d::a6]:37960 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 6547 X-Received-Body-CRC: 414819229 Xref: csiph.com comp.lang.python:80337 --047d7b5db7fae856d6050732aa0e Content-Type: text/plain; charset=UTF-8 On Nov 6, 2014 1:06 AM, "Rustom Mody" wrote: > In studying (somewhat theoretically) the general world of > collection data structures we see > - sets -- neither order nor repetition > - bags -- no order, repetition significant > - lists -- both order and repetition > > Sometimes 'bag' is called 'multiset' > However counter is a weird non-standard name that overloads > an already overloaded term -- 'Counter' has a very standard meaning in programming and in hardware design. "Bag" is also nonstandard. Other nonstandard names for the same type include list, heap, bunch, sample, weighted set, occurrence set and fireset. Knuth uses multiset, so let's stick with that. As for Counter already having meanings in CS, the Python Counter is compatible with those. > Calling a bag as counter is inappropriate for an analogous reason > to why calling a dictionary as a 'hash' is inappropriate -- > it confuses an implementation detail for fundamental semantics. I've never liked the term "bag". In addition to being nonstandard it's also very nonintuitive. "Multiset" is fine, except that it implies the collection is a type of set, which the Python Counter is not. The name "Counter" describes the intended use case, not the implementation, so I think it's fine. --047d7b5db7fae856d6050732aa0e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Nov 6, 2014 1:06 AM, "Rustom Mody" <rustompmody@gmail.com> wrote:
> In studying (somewhat theoretically) the general world of
> collection data structures we see
> - sets=C2=A0 -- neither order nor repetition
> - bags=C2=A0 -- no order, repetition significant
> - lists -- both order and repetition
>
> Sometimes 'bag' is called 'multiset'
> However counter is a weird non-standard name that overloads
> an already overloaded term -- 'Counter' has a very standard me= aning in programming and in hardware design.

"Bag" is also nonstandard. Other nonstandard names= for the same type include list, heap, bunch, sample, weighted set, occurre= nce set and fireset. Knuth uses multiset, so let's stick with that.

As for Counter already having meanings in CS, the Python Cou= nter is compatible with those.

> Calling a bag as counter is inappropriate for an analog= ous reason
> to why calling a dictionary as a 'hash' is inappropriate -- > it confuses an implementation detail for fundamental semantics.

I've never liked the term "bag". In addition t= o being nonstandard it's also very nonintuitive. "Multiset" i= s fine, except that it implies the collection is a type of set, which the P= ython Counter is not.

The name "Counter" describes the intended use case= , not the implementation, so I think it's fine.

--047d7b5db7fae856d6050732aa0e--