Python-Functional Programming Learning notes

Source: Internet
Author: User
  • High Order function
  1. Map (f,iterable), the F function in the iterable each element and then return a iterator, and then use the list (map (f,iterable)) to convert the results of a iterable;
  2. Reduce (f,iterable), function f must receive two parameters [such as f (x, y), x represents the previous cumulative result, y represents an element in the sequence that is currently participating in the operation],reduce returns a cumulative result;
  3. Filter (f,iterable), filters the function, the F function in sequence each element, if the result is true retains the element, finally obtains a iterator;
  4. Sorted (iterable,key=f), sort function, returns a iterable with a custom sort that returns the result of f as the key value, sorted (iterable,key=f,reverse=true) indicates a reverse sort.

Python-Functional Programming Learning notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.