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

Georg Brandl g.brandl at gmx.net
Sat Mar 10 23:06:56 CET 2007


Tony Lownds schrieb:
> 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))
> ...

If you do that, please parenthesize the lambda.

Georg



More information about the Python-3000 mailing list