The following works in python2 for calling the list of function objects stored in the functions list:
for f in functions:
map(f, data)
What is the equivalent for python3 as the above doesn’t seem to work
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
mapin Python 3 returns an iterator, that’s why nothing happens when you just call it.Since you apparently don’t care about returned values, I think it’s best to use an explicit loop:
If you actually do store the results in Python2:
then you could to change it to
But I’d advise against using a list if you don’t actually need the return values. It takes extra time and memory to build them and discard them right away.