I am shifting to Python, and am still relatively new to the pythonic approach. I want to write a function that takes a string and a list and returns true if all the elements
For fun, I thought I'd do it with iterators and map:
from operator import contains
from itertools import imap, repeat
def myfun(str, list):
return all(imap(contains, repeat(str), list))
Then I realised that this essentially does the same thing as the accepted answer, but probably with more method calls.
def myfun(str, list):
return all(letter in str for letter in list)