On Mar 22, 4:56 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Paddy <[EMAIL PROTECTED]> wrote: > > ... > > > I have found that I have gone too far when I used listcomps for their > > sideeffects rather than wanting the list produced, for example the > > I agree. > > > second listcomp below is an expression as statement I don't want the > > list produced - just the effect on data. > > > >>> # some random ranges > > >>> data = [range(random.randrange(3,7)) for x in range(4)] > > >>> # but I want each range jumbled > > >>> [ random.shuffle(d) for d in data] > > [None, None, None, None] > > >>> data > > [[2, 0, 3, 1], [0, 2, 1], [3, 4, 1, 0, 2], [2, 1, 0, 3]] > > > (I do know how to re-write it). > > for d in data: random.shuffle(d) > > Alex
Hah, "You just couldn't let it lie" ;-) I just knew someone would bite, and re-write it. Now to reel, you in. Its fish for dinner today! - Paddy. -- http://mail.python.org/mailman/listinfo/python-list