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

From Cameron Simpson <cs@zip.com.au>
Newsgroups comp.lang.python
Subject Re: Fast pythonic way to process a huge integer list
Date 2016-01-07 14:31 +1100
Message-ID <mailman.37.1452137521.2305.python-list@python.org> (permalink)
References <7e2b93e4-c224-40c4-8e88-7dcc847edab1@googlegroups.com>

Show all headers | 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