Python built-in function map/reduce/filter These three functions are handy, very cool.
filter () function: The filter function is equivalent to filtering, calling a Bool_func (a method that returns only bool type data) to iterate through the elements in each sequence.
Returns the sequence of elements that bool_func the result to true (note what the sequence means) http://blog.csdn.net/bolike/article/details/19997465 sequence reference </a>
If the filter parameter value is the None,list parameter, all elements that are false are deleted.
map () function :
Iterates through all the elements in the sequence, returns a sequence after processing
Reduce function:
Func takes two arguments, so each time a pair is taken (the previous result and the next element), a result is returned.
The advanced function, which is the function as a parameter, then make a mess.
I am not very good with these three functions, the only way is to use more, with the use of the habit, like the original I am not accustomed to using the list to generate the formula.
Later, the discovery list generation is particularly hassle-free, now don't be unhappy. hahaha, let's use these high-level functions together to make your code more concise and more readable.
[Python Basics]python built-in functions Map/reduce/filter