Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Cameron Simpson Newsgroups: comp.lang.python Subject: Re: Fast pythonic way to process a huge integer list Date: Thu, 7 Jan 2016 14:31:56 +1100 Lines: 14 Message-ID: References: <7e2b93e4-c224-40c4-8e88-7dcc847edab1@googlegroups.com> Reply-To: python-list@python.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Trace: news.uni-berlin.de J4OmDe7NcKHysIARaQEI8gcEzy2ReZtMmd4c9+yVDn3A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'list?': 0.07; 'cc:addr :python-list': 0.09; '128': 0.09; 'chunks': 0.09; 'subject:process': 0.09; 'python': 0.10; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'integers.': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'pythonic': 0.16; 'range(0,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'simpson': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cheers,': 0.22; 'cc:no real name:2**0': 0.22; 'elements': 0.23; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'subject:list': 0.26; 'probably': 0.31; 'file': 0.34; 'list': 0.34; 'subject:: ': 0.37; 'say': 0.37; 'charset:us-ascii': 0.37; 'starting': 0.37; 'received:localdomain': 0.38; 'stuff': 0.38; 'mean': 0.38; 'email addr:gmail.com': 0.62; 'cameron': 0.66; "they're": 0.66; 'header :Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'reply- to:addr:python.org': 0.84; 'subject:Fast': 0.84 Content-Disposition: inline In-Reply-To: <7e2b93e4-c224-40c4-8e88-7dcc847edab1@googlegroups.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101318 On 06Jan2016 18:36, high5storage@gmail.com wrote: >I have a list of 163.840 integers. What is a fast & pythonic way to process >this list in 1,280 chunks of 128 integers? The depends. When you say "list", is it already a _python_ list? Or do you just mean that the intergers are in a file or something? If they're already in a python list you can probably just use a range: for offset in range(0, 163840, 128): ... do stuff with the elements starting at offset ... Cheers, Cameron Simpson