Use a generator instead: ``set(s.strip() for s in sequence)``, or use ``imap``.