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


Groups > comp.lang.python > #101318

Re: Fast pythonic way to process a huge integer list

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Cameron Simpson <cs@zip.com.au>
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 <mailman.37.1452137521.2305.python-list@python.org> (permalink)
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 <cameron@cskk.homeip.net>
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 <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>
Xref csiph.com comp.lang.python:101318

Show key headers only | View raw


On 06Jan2016 18:36, high5storage@gmail.com <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 <cs@zip.com.au>

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


Thread

Fast pythonic way to process a huge integer list high5storage@gmail.com - 2016-01-06 18:36 -0800
  Re: Fast pythonic way to process a huge integer list Terry Reedy <tjreedy@udel.edu> - 2016-01-06 22:10 -0500
  Re: Fast pythonic way to process a huge integer list Tim Chase <python.list@tim.thechases.com> - 2016-01-06 21:21 -0600
  Re: Fast pythonic way to process a huge integer list Cameron Simpson <cs@zip.com.au> - 2016-01-07 14:31 +1100
  Re: Fast pythonic way to process a huge integer list Steven D'Aprano <steve@pearwood.info> - 2016-01-07 20:25 +1100
  Re: Fast pythonic way to process a huge integer list Peter Otten <__peter__@web.de> - 2016-01-07 11:21 +0100
  Re: Fast pythonic way to process a huge integer list KP <kai.peters@gmail.com> - 2016-01-07 16:33 -0800

csiph-web