[Python-ideas] Minimal built-ins (+ tiny doc suggestion)

Steven D'Aprano steve at pearwood.info
Fri May 25 11:09:29 CEST 2012


Nick Coghlan wrote:

> I'd personally agree with filter() moving, but "map(str, seq)" still
> beats "(str(x) for x in seq)" by a substantial margin for me when it
> comes to quickly and cleanly encapsulating a common idiom such that it
> is easier both to read *and* write.

filter(None, seq)
[obj for obj in seq if obj]

I think the version with filter is *much* better than the second.


-- 
Steven




More information about the Python-ideas mailing list