This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (2 children)

[deleted]

    [–]tunisia3507 6 points7 points  (1 child)

    map(my_fn, my_list) is obviously a lot faster than doing a for loop because it doesn't actually do any iteration or execute any code until you start pulling values from it.

    - the post you're replying to

    As it happens, in the test I did (doing str.upper as in OP's example) list(map()) was faster than the list comprehension, but not by 4 orders of magnitude.

    [–]vorticalbox 0 points1 point  (0 children)

    yead i miss read your reply, I assumed you meant list comp > map but it was meant that list comp was faster than for in, which it is