D H wrote: > [EMAIL PROTECTED] wrote: > >>> You can use i**=2 for i in range(1000) instead >> >> >> >> I don't think one can use assignment in list comprehension or generator >> expression. The limitation is very much like lambda. >> > > i**2
lst=[i**2 for i in range(1000)] you will get a list with 1000 items [0,1,4,9 ... ] is not the same as i,lst=2,[] while i<1000: i**=2 lst.append(i) here you get [4,16,256,65536] only 4 items Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list