idiom for initial list of lists
Pekka Pessi
Pekka.Pessi at nokia.com
Sun Sep 10 15:31:51 EDT 2000
More information about the Python-list mailing list
Sun Sep 10 15:31:51 EDT 2000
- Previous message (by thread): idiom for initial list of lists
- Next message (by thread): idiom for initial list of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In message <Pine.LNX.4.21.0009081645290.1107-100000 at fep132.fep.ru> Oleg Broytmann <phd at phd.russ.ru> writes: >> so I'm forced to use the rather pedantic >> S=[] >> for i in range(n): S[i].append([]) > That's the only and one correct way. I prefer list(): >>> a = map(list, 5 * [[]]) >>> a[0].append(1) >>> a [[1], [], [], [], []] or >>> a = map(list, 5 * ((),)) >>> a [[], [], [], [], []] >>> a[0].append(1) >>> a [[1], [], [], [], []] Pekka
- Previous message (by thread): idiom for initial list of lists
- Next message (by thread): idiom for initial list of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list