[Python-Dev] 2.5 and beyond (original) (raw)

Bill Janssen janssen at parc.com
Sat Jul 1 03:31:12 CEST 2006


>>> a = [] >>> for i in range(10): ... a.append(lambda: i) ... >>> print [x() for x in a] [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]

Isn't this exactly what you'd expect? Maybe I've been writing Python for too long... :-).

Bill



More information about the Python-Dev mailing list