While processing a list using map(), I want to access index of the item while inside lambda. How can I do that?
For example
ranked_users = [\'jon\',\
Actually here is a more elegant, verbose solution than using an enumerate tuple in the map (because of tuple indexing). Map can take more iterables as arguments so let's use it.
map(lambda user, user_id: (user_id, user), ranked_users, range(ranked_users.__len__()))