"Try it now"

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Apr 14 13:29:35 PDT 2011


On 4/14/11 3:31 PM, bearophile wrote:
> Andrei:
>
>> BTW there is a proposal to change group to yield a range of ranges
>> instead of a range of tuples.
>>
>> Do you folks estimate this could cause significant harm to existing code?
>
> This proposal makes group closer to the semantics of the Python itertools.groupby. This change doesn't harm my code significantly.
>
> But in my Python code most times I use groupby I have to convert the inner generator (the inner range) in something eager. So for me the current behaviour of group is OK. What are the reasons to change it?
>
> Bye,
> bearophile

The reasons for changing is that often you have groups in which elements 
are not identical, but instead in the same equivalence class. So you 
want not only their number - you want to take a look at the actual 
items. (Consider e.g. grouping some strings by their length.)

Andrei


More information about the Digitalmars-d mailing list