map-like function on dict values?

Huaiyu Zhu huaiyu at
Thu Feb 28 02:04:50 CET 2002

Is there a way to do this

for k, v in dict.items():
    dict[k] = f(v)

without involving a Python for loop?  I'd imagine that a function
implemented in C could speed things up quite a bit.  Something like
either of the following

mapvalue(f, dict)


More information about the Python-list mailing list