itertools: problem with nested groupby, list()

Ulrich Eckhardt eckhardt at satorlaser.com
Tue May 4 08:09:41 EDT 2010


Nico Schlömer wrote:
> So when I go like
> 
> for item in list:
>     item[1].sort()
> 
> I actually modify *list*? I didn't realize that; I thought it'd just
> be a copy of it.

No, I misunderstood your code there. Modifying the objects inside the list
is fine, but I don't thing you do that, provided the items in the list
don't contain references to the list itself.

Good luck!

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list