[Tutor] differences between map and partial?

source liu sourceonly at gmail.com
Tue Sep 27 05:23:52 EDT 2016


Hi, List

the test code as attached

first i tried map, and failed,
then i turned to partial from functools

the latter one works, i wonder if there is unseen tricky from me
between them :)


    this one works >>>>print p.map(partial(file_op,lineop=unity),input)
    this one doesn't work >>>>print p.map(lambda x:file_op(x,unity), input)



Thanks.

-- 
Liu An
Institution of modern physics, Shanghai, China


More information about the Tutor mailing list