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', 3:'parker', 5:'wayne' }

# The thing I couldn't figure out is, after I insert a
# surname the rest of the indices are not valid.
# That is, the following won't work:
for i, x in surnames.iteritems():
   names.insert(i,surnames[i])
###

I am searching a nice way to do this. For instance, is there a more
robust way to store indices (as some sort of pointers maybe?) 

- Levent

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to