Idea for key parameter in all() builting, would it be feasible?

Russel Walker russ.pobox at gmail.com
Thu Jun 20 10:49:38 EDT 2013


On Thursday, June 20, 2013 12:45:27 PM UTC+2, Antoon Pardon wrote:
> Op 19-06-13 18:14, russ.pobox at gmail.com schreef:
> 
> >
> 
> >>>> all(map(lambda x: bool(x), xrange(10**9)))
> 
> 
> 
> Since you already have your answer, I just like to get your attention
> 
> to the fact the the lambda is superfluous here. Your expression
> 
> above is equivallent to
> 
> 
> 
>   all(map(bool, xrange(10**9)))

That's true, I didn't notice that. Although it was a trivial example I was setting up from the actual code and couldn't think of what to shove inside lambda so bool got the short straw.

The latest example I showed was actually.

>>> all(map(lambda x: n%x, xrange(2, n))) 



More information about the Python-list mailing list