Still unrequired loops here. Apply your map at the same time that you apply your comprehension. Or use imap to get nested generator comprehensions.