Wishlist item: itertools.flatten
Jack Diederich
jack at performancedrivers.com
Fri Mar 11 19:29:28 EST 2005
On Sat, Mar 12, 2005 at 12:55:38AM +0200, Christos TZOTZIOY Georgiou wrote:
> On 12 Mar 2005 00:44:39 +0200, rumours say that Ville Vainio
> <ville at spammers.com> might have written:
>
> > Christos> This is just a personal opinion, but I detest restraints
> > Christos> on library (itertools module in this case) expansion
> > Christos> when talking about such useful *building blocks*.
> >
> >Yeah - esp. in the case of flattening. If it was deemed useful enough
> >to be the default behavior in perl (which is admittedly braindamaged),
> >it should surely warrant being included as a single function in the
> >stdlib.
>
> Or a window function, which I have needed enough times in *separate* occasions
> to add it in one of my personal "stdlib" modules (hinting it could be part of
> itertools):
>
> window('hello', 2) => 'he', 'el', 'll', 'lo'
This was considered for 2.4, and I put in a patch if you want a C-level
implementation[1]. The patch wasn't much faster than doing it in python (two
times, IIRC), the python version is trivial, and almost no one wanted it. So
Hettinger and I agreed it should be left out.
-Jack
[1] http://sourceforge.net/tracker/?group_id=5470&atid=305470&func=detail&aid=756253
More information about the Python-list
mailing list