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


Groups > comp.lang.python > #44597

Re: Why chunks is not part of the python standard lib?

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: Why chunks is not part of the python standard lib?
Date 2013-05-01 09:30 -0700
Organization Nightsong/Fort GNOX
Message-ID <7xy5byacis.fsf@ruckus.brouhaha.com> (permalink)
References <CAP5i+tYC+cMtseEduTm76LXkaP1Hh-Tz-_HipO7LsURtnuwtOw@mail.gmail.com> <mailman.1219.1367425160.3114.python-list@python.org>

Show all headers | View raw


Serhiy Storchaka <storchaka@gmail.com> writes:
> def chunks(seq, size):
>     return [seq[i: i + size] for i in range(0, len(seq), size)]

That's just for lists.  An itertools version would work with arbitrary
iterables.  I've also had to rewrite that function more times than seems
proper.

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


Thread

Re: Why chunks is not part of the python standard lib? Serhiy Storchaka <storchaka@gmail.com> - 2013-05-01 19:19 +0300
  Re: Why chunks is not part of the python standard lib? Paul Rubin <no.email@nospam.invalid> - 2013-05-01 09:30 -0700

csiph-web