[Python-3000] generics [was: Discussions with no PEPs]

Guido van Rossum guido at python.org
Mon Mar 12 19:09:42 CET 2007


Actually, I like the version with t[0]-t[1] better. This is supposed
to be an exposition about groupby. Working out how it works, the
version with count() seems to take more effort.

But thanks for doing this! Is it done, apart from this nit? Then I'll
check it in.

--Guido

On 3/10/07, Tony Lownds <tony at pagedna.com> wrote:
>
> On Mar 9, 2007, at 2:35 PM, Guido van Rossum wrote:
>
> > On 3/9/07, Tony Lownds <tony at pagedna.com> wrote:
> >> By the way, I would like to work on either removing tuple parameters
> >> in 3.0
> >
> > That would be great!
> >
>
> I've posted a patch removing tuple parameters as #1678060.
>
> There was one case in itertools tests/docs where IMO readability was
> lost:
>
> ->>> for k, g in groupby(enumerate(data), lambda (i,x):i-x):
> +>>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]):
> ...     print(map(operator.itemgetter(1), g))
>
> Is it OK to replace this with:
>
>  >>> for k, g in groupby(data, lambda i, c=count(): c.next()-i):
> ...   print(list(g))
> ...
>
>
> -Tony
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list