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


Groups > comp.lang.python > #79443

Re: (-1)**1000

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.038
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'python3': 0.07; '22,': 0.09; '10000000': 0.16; 'check",': 0.16; 'record,': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'looks': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'tim': 0.29; 'message- id:@mail.gmail.com': 0.30; 'usually': 0.31; 'chase': 0.31; 'constant': 0.31; 'context.': 0.31; 'time:': 0.31; 'another': 0.32; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'otten': 0.84; 'parity': 0.84
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 :content-type; bh=SLc9lk71D2KL5SWbPP3wRangUq/80ubhmtxtst7fogU=; b=HWh4nfSxS8IAGhAhsbA3sOdqBeDra4V0yX246LADnAeiiSY3V85lZOu3qIBO/8UvCE ZHTEOW5qGq0u25otW91C7d87Jgx/hc13W6gdKn3OlkwAhE2OroSXWAiqPQ8cNmYsPn9B oWRYav3JWntvjTLRIPTKR+Qw7AYNy+shOd97zyDaNP3Nz2mrNfN+lETNa3U5Yp6lDiIe rEG7eJnVZnCmy+pYNg0gwPhvQ2vzH2Qmj1kBxK1icJfIo2DSZPds4Bp9igDdXcx+l9Vb r4unTPI2Iu8oQxibxPNjH+NfPRhBWqx0gkoGnNeCYptjmtmVK0eiLYl5FiaND3fCoPAl 3RJw==
X-Received by 10.68.175.196 with SMTP id cc4mr4142212pbc.147.1413988193684; Wed, 22 Oct 2014 07:29:53 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <20141022054302.6daea15b@bigbox.christie.dr>
References <54476a77$0$21664$426a74cc@news.free.fr> <mailman.15058.1413968065.18130.python-list@python.org> <5447786d$0$12750$426a74cc@news.free.fr> <m280ur$aho$1@ger.gmane.org> <20141022054302.6daea15b@bigbox.christie.dr>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 22 Oct 2014 08:29:13 -0600
Subject Re: (-1)**1000
To Python <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 <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.15074.1413988202.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413988202 news.xs4all.nl 2829 [2001:888:2000:d::a6]:40882
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79443

Show key headers only | View raw


On Wed, Oct 22, 2014 at 4:43 AM, Tim Chase
<python.list@tim.thechases.com> wrote:
> On 2014-10-22 12:29, Peter Otten wrote:
>> That looks like log(a) while a parity check takes constant time:
>>
>> $ python3 -m timeit -s 'a = 10**10' 'a & 1'
>> 10000000 loops, best of 3: 0.124 usec per loop
>> $ python3 -m timeit -s 'a = 10**100' 'a & 1'
>> 10000000 loops, best of 3: 0.124 usec per loop
>> $ python3 -m timeit -s 'a = 10**1000' 'a & 1'
>> 10000000 loops, best of 3: 0.122 usec per loop
>
> Just for the record, this is a one-bit even/odd check

Which is just a verbose way of writing "parity check", even if that
phrase is usually used in another context.

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


Thread

(-1)**1000 "ast" <nomail@invalid.com> - 2014-10-22 10:27 +0200
  Re: (-1)**1000 Chris Angelico <rosuav@gmail.com> - 2014-10-22 19:54 +1100
    Re: (-1)**1000 "ast" <nomail@invalid.com> - 2014-10-22 11:27 +0200
      Re: (-1)**1000 Peter Otten <__peter__@web.de> - 2014-10-22 12:29 +0200
      Re: (-1)**1000 Michiel Overtoom <motoom@xs4all.nl> - 2014-10-22 12:38 +0200
      Re: (-1)**1000 Tim Chase <python.list@tim.thechases.com> - 2014-10-22 05:43 -0500
      Re: (-1)**1000 Peter Otten <__peter__@web.de> - 2014-10-22 13:02 +0200
      Re: (-1)**1000 Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-22 08:23 -0600
      Re: (-1)**1000 Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-22 08:29 -0600
      Re: (-1)**1000 Ned Batchelder <ned@nedbatchelder.com> - 2014-10-22 11:01 -0400
    Re: (-1)**1000 wxjmfauth@gmail.com - 2014-10-22 04:35 -0700
  Re: (-1)**1000 Peter Otten <__peter__@web.de> - 2014-10-22 11:13 +0200
  Re: (-1)**1000 Terry Reedy <tjreedy@udel.edu> - 2014-10-22 13:15 -0400
  Re: (-1)**1000 Dave Angel <davea@davea.name> - 2014-10-24 13:57 -0400
  Re: (-1)**1000 Tony the Tiger <tony@tiger.invalid> - 2014-10-26 20:07 +0000
    Re: (-1)**1000 Ned Batchelder <ned@nedbatchelder.com> - 2014-10-26 16:45 -0400
    Re: (-1)**1000 Stefan Behnel <stefan_ml@behnel.de> - 2014-10-29 20:31 +0100

csiph-web