Re: add elements to indexed list locations

2006-06-17 Thread Steven Bethard
levent wrote: > Thanks for the answers. Enumerating in reverse is indeed quite a smart > idea. > > The fact is though, I overly simplified the task in the super-hero > example. In the real case, the dictionary keys are not necessarily the > indices for inserts; that is to say, the inserts do not n

Re: add elements to indexed list locations

2006-06-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, levent wrote: > I think I was thinking more of a linked-list idea, where you do not > store the indices as integers to some random access array but rather as > pointers into list's nodes. Then the subsequent inserts would not hurt > previously stored pointers. For those who

Re: add elements to indexed list locations

2006-06-17 Thread Peter Otten
levent wrote: > Thanks for the answers. Enumerating in reverse is indeed quite a smart > idea. > > The fact is though, I overly simplified the task in the super-hero > example. In the real case, the dictionary keys are not necessarily the > indices for inserts; that is to say, the inserts do not

Re: add elements to indexed list locations

2006-06-17 Thread levent
Thanks for the answers. Enumerating in reverse is indeed quite a smart idea. The fact is though, I overly simplified the task in the super-hero example. In the real case, the dictionary keys are not necessarily the indices for inserts; that is to say, the inserts do not necessarily take place in s

Re: add elements to indexed list locations

2006-06-16 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > # I have a list of names: > names = ['clark', 'super', 'peter', 'spider', 'bruce', 'bat'] > > # and another set of names that I want to insert into > # the names list at some indexed locations: > surnames = { 1: 'kent', 3:'parker', 5:'wayne' } > > # The thing I couldn't

Re: add elements to indexed list locations

2006-06-16 Thread Alexis Roda
En/na [EMAIL PROTECTED] ha escrit: > Hi, > > I have a very simple problem, but do not know an elegant way to > accomplish this. > ### > # I have a list of names: > names = ['clark', 'super', 'peter', 'spider', 'bruce', 'bat'] > > # and another set of names that I want to insert into > # the names

Re: add elements to indexed list locations

2006-06-16 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hi, > > I have a very simple problem, but do not know an elegant way to > accomplish this. > ### > # I have a list of names: > names = ['clark', 'super', 'peter', 'spider', 'bruce', 'bat'] > > # and another set of names that I want to insert into > # the names list at

add elements to indexed list locations

2006-06-16 Thread leventyilmaz
Hi, I have a very simple problem, but do not know an elegant way to accomplish this. ### # I have a list of names: names = ['clark', 'super', 'peter', 'spider', 'bruce', 'bat'] # and another set of names that I want to insert into # the names list at some indexed locations: surnames = { 1: 'kent'