[EMAIL PROTECTED] wrote: > Thank you both, the assigning using slicing works perfectly (as I'm > sure you knew it would)... It just didn't occur to me because it > seemed a little nonintuitive... The specific application was > > def dicttolist (inputdict): > finallist=[] > for k, v in inputdict.iteritems(): > temp = v > temp.insert(0,k) > finallist.append(temp) > > return finallist >
Maybe, finallist = [[k] + v for k, v in inputdict.iteritems()] the list concatenation creating new lists. Duncan -- http://mail.python.org/mailman/listinfo/python-list