Mar-08-2017, 08:05 PM
>>> flist = [] >>> for i in range(3): ... flist.append(lambda: i) ... >>> [f() for f in flist] # what will this print out?Why is the above output [2,2,2]?
Thanks,
L
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
![]() |
Common understanding of output processing with conditional statement | neail | 6 | 2,018 |
Sep-17-2023, 03:58 PM Last Post: neail |
Help understanding RegEx logic/output | pyNewbee | 4 | 3,217 |
Nov-15-2020, 02:21 AM Last Post: pyNewbee |
|
understanding output of bytes/raw data | rootVIII | 3 | 3,635 |
Aug-01-2019, 01:00 PM Last Post: rootVIII |
|
Understanding "help()" output? | Athenaeum | 4 | 4,806 |
Sep-29-2017, 09:47 PM Last Post: nilamo |