[Tutor] List Comprehension (shared references)
Thu Apr 24 23:51:01 2003
I'm just getting my feet wet with list comprehensions.
I need to write a function that returns a nested list
of empty lists.
It seems simple, but I'm a python newbie and I don't
want to leave myself that can bite me later...
The following console session seems to fit the bill.
x = 7
>>> ml = [ for row in range(x)]
[, , , , , , ]
# Now that *seems* to be what I'm looking for :-)
[, ['test'], , , , , ]
There appears to be no shared references.
Am I correct here?
Tim Johnson <email@example.com>