Is there a way to map a list onto a dictionary? What I want to do is give it a function that will return the name of a key, and the value will be the original value. For example
If I understand your question correctly, I believe you can accomplish this with a combination of map, zip, and the dict constructor:
map
zip
dict
def dictMap(f, xs) : return dict(zip(map(f, xs), xs)
And a saner implementation :
def dictMap(f, xs) : return dict((f(i), i) for i in xs)