$ 0 0 bad = []good = [x for x in mylist if x in goodvals or bad.append(x)]append returns None, so it works.