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


Groups > comp.lang.python > #62034

Re: Comparing values of counter in python 3.3

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jeanpierreda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '16,': 0.03; 'reject': 0.07; 'cc:addr:python-list': 0.11; '2)]': 0.16; "[('a',": 0.16; 'subject:3.3': 0.16; 'subject:values': 0.16; 'subtraction': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; '15,': 0.26; 'compare': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'monday,': 0.33; 'december': 0.35; 'received:google.com': 0.35; 'skip:[ 10': 0.38; 'pm,': 0.38; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'rusi': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=GuicWXM0bmnv2gpldmxE08CwrR1rEKRAhdfzTrPOkaI=; b=hJ4mAMeJQ2wyLrBgISTyIP0kShn8RnVfAxyYJXNmEZU5IA0Ec4MXP0VJchXYjInwAm NnBCN2tmDerJOpgfDKtHTi0i3TAX2RPVZhAc0emll+YRD6JA5CgKcTY7UJArzliorYgv h2gN9xbe1bnCjDRG2YheeD+cLSsyVLzXm2zNSHeqamI/92ffhJyrXGeY9NiuBRF+OcIi 26xSEgDe6E5DYQIAK7Nzmoyt6nm54C6NPqAuG65pzg+mtLXCDIjnxagDgzBMoTRIoG0G LFBSthtFXxxoJ9ZVg6Ut104FDyJs7+fN7eZPPxhEK6Oxx//Rhj4AWrIYfRzrrf88nSE8 LstA==
X-Received by 10.224.67.137 with SMTP id r9mr31001036qai.8.1387187481596; Mon, 16 Dec 2013 01:51:21 -0800 (PST)
MIME-Version 1.0
In-Reply-To <905d6e7e-6748-42dd-8b63-d80a4d175914@googlegroups.com>
References <7b7028b8-5de0-4a3a-a23b-2e19fe859955@googlegroups.com> <l8lmq6$6ps$1@dont-email.me> <905d6e7e-6748-42dd-8b63-d80a4d175914@googlegroups.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date Mon, 16 Dec 2013 01:50:41 -0800
Subject Re: Comparing values of counter in python 3.3
To rusi <rustompmody@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc "comp.lang.python" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4195.1387187483.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387187483 news.xs4all.nl 2901 [2001:888:2000:d::a6]:35448
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62034

Show key headers only | View raw


On Sun, Dec 15, 2013 at 6:32 PM, rusi <rustompmody@gmail.com> wrote:
> On Monday, December 16, 2013 7:29:31 AM UTC+5:30, alex23 wrote:
>> > # Need to compare values of counter and reject in function/routine in value in counter2 is higher then value in counter1 for a current key
>
>>      [(k,Counter2[k]) for k in Counter2 - Counter1]
>
> Why not just?
>
> Counter2 - Counter1
>
> And if you want to uncounterify it then
> dict(Counter2 - Counter1)

Because you get different counts.

>>> c1 = Counter('ab')
>>> c2 = Counter('aab')
>>> c2 - c1
Counter({'a': 1})
>>> [(k, c2[k]) for k in c2 - c1]
[('a', 2)]

Counter subtraction is multiset subtraction, not set subtraction.

-- Devin

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Comparing values of counter in python 3.3 Amjad Syed <amjadcsu@gmail.com> - 2013-12-11 23:49 -0800
  Re: Comparing values of counter in python 3.3 Wolfgang Maier <xpysol@gmail.com> - 2013-12-12 01:55 -0800
    Re: Comparing values of counter in python 3.3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-12 10:11 +0000
  Re: Comparing values of counter in python 3.3 alex23 <wuwei23@gmail.com> - 2013-12-16 11:59 +1000
    Re: Comparing values of counter in python 3.3 rusi <rustompmody@gmail.com> - 2013-12-15 18:32 -0800
      Re: Comparing values of counter in python 3.3 Chris Angelico <rosuav@gmail.com> - 2013-12-16 13:37 +1100
      Re: Comparing values of counter in python 3.3 Roy Smith <roy@panix.com> - 2013-12-15 21:40 -0500
        Re: Comparing values of counter in python 3.3 rusi <rustompmody@gmail.com> - 2013-12-15 19:28 -0800
        Re: Comparing values of counter in python 3.3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-16 09:20 +0000
      Re: Comparing values of counter in python 3.3 Devin Jeanpierre <jeanpierreda@gmail.com> - 2013-12-16 01:50 -0800

csiph-web