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


Groups > comp.lang.python > #82266

Re: Nested loops is strangely slow, totally at a loss.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.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 <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'exist,': 0.09; 'cc:addr :python-list': 0.11; '"in"': 0.16; 'does,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iterator,': 0.16; 'iterators': 0.16; 'stuff.': 0.16; 'subject:slow': 0.16; 'think.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; 'membership': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'could': 0.34; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'should': 0.36; 'pm,': 0.38; 'range': 0.61; "it'd": 0.84; 'to:none': 0.92
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:cc :content-type; bh=lhB8RX09K4kCWYBY43Dv0qZPMBHVYy20pqmS2reyMvo=; b=0ScHlLr3mIshK2yOwh0M7uwpR/isXSObZCBYTje8ZzmetOm6WlJSG7ctWU5qSNGvwU tsPBqH3kkUYL9ZFSUXNnY8OdVK0FV1PUP+4xgnKcFItzmQyl7x92V8NSKXNBrLQfcGQQ LAJH9DJFotG+47J6/EXEouPNChGpa3L/jNn+hvVkZzVexi1/GB0vKpjhVymicMICebVQ sQQi9Eb2gMvkF/798uCEIlX73hr0O2IjI8b0CIJ5OYndXwdFui/EidmIFuhyJg+1FGo3 U2GwLNmRbWeWyRR9uETcFPuF3jjn1qgFMmN9b49ucgYMXXHHF/g17ABw6Bp45czAcyaB USFA==
MIME-Version 1.0
X-Received by 10.50.62.104 with SMTP id x8mr24348047igr.2.1418194385904; Tue, 09 Dec 2014 22:53:05 -0800 (PST)
In-Reply-To <5487ebc7$0$2817$c3e8da3$76491128@news.astraweb.com>
References <mailman.16794.1418188833.18130.python-list@python.org> <5487ebc7$0$2817$c3e8da3$76491128@news.astraweb.com>
Date Wed, 10 Dec 2014 17:53:05 +1100
Subject Re: Nested loops is strangely slow, totally at a loss.
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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.16798.1418194395.18130.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418194395 news.xs4all.nl 2940 [2001:888:2000:d::a6]:48069
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82266

Show key headers only | View raw


On Wed, Dec 10, 2014 at 5:44 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> It would be nice if product iterators behaved like xrange() objects and
> could perform "in" tests without exhausting the iterator, but they don't.
> That's sad.

It'd be very difficult to do that in the general sense. But it should
be possible to have a multi-dimensional range object that behaves the
way Py3's range object does, including membership tests and stuff.
(Might already exist, for all I know.) That would do what the OP
wants, I think.

ChrisA

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


Thread

Nested loops is strangely slow, totally at a loss. Shiyao Ma <i@introo.me> - 2014-12-10 13:20 +0800
  Re: Nested loops is strangely slow, totally at a loss. Steven D'Aprano <steve@pearwood.info> - 2014-12-10 06:44 +0000
    Re: Nested loops is strangely slow, totally at a loss. Chris Angelico <rosuav@gmail.com> - 2014-12-10 17:53 +1100
      Re: Nested loops is strangely slow, totally at a loss. Steven D'Aprano <steve@pearwood.info> - 2014-12-10 07:21 +0000
    Re: Nested loops is strangely slow, totally at a loss. Terry Reedy <tjreedy@udel.edu> - 2014-12-10 02:16 -0500

csiph-web