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: 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: <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 Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Wed, Dec 10, 2014 at 5:44 PM, Steven D'Aprano 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