A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034930.html below:

summing a bunch of numbers (or "whatevers")

[Python-Dev] Fwd: summing a bunch of numbers (or "whatevers")Barry Warsaw barry@python.org
22 Apr 2003 22:42:01 -0400
On Tue, 2003-04-22 at 21:35, Greg Ward wrote:
> On 21 April 2003, Tim Peters said:
> > filter() is hard to get rid of because the bizarre filter(None, seq) special
> > case is supernaturally fast.  Indeed, time the above against
> 
> Hmmm, a random idea: has filter() ever been used for anything else?
> I didn't think so.  So why not remove everything *except* that handy
> special-case: ie. in 3.0, filter(seq) == filter(None, seq) today, and
> that's *all* filter() does.

I've never used it for anything else, but I'm also just as happy to use

[x for x in seq if x]

Although it's a bit verbose, TOOWTDI.

-Barry






RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4