Removing None objects from a sequence
gruszczy at gmail.com
Fri Dec 12 10:18:35 CET 2008
I would like to iterate over a sequence nad ignore all None objects.
The most obvious way is explicitly checking if element is not None,
but it takes too much space. And I would like to get something faster.
I can use
[ sth for sth in self.__sth if not sth is None ], but I don't know if
that's the best way. I checked itertools, but the only thing that
seemed ok, was ifilter - this requires seperate function though, so
doesn't seem too short. How can I get it the shortest and fastest way?
More information about the Python-list