Functional programming of Python

Source: Internet
Author: User

A function is a wrapper built into Python, and we can break up complex tasks into simple tasks by splitting large pieces of code into functions and using a layer of function calls, which can be called process-oriented

The design of the sequence. function is the basic unit of process-oriented program design .

and functional programming (note that more than one "type" word)--functional programming, although it can also be attributed to the process-oriented programming, but the idea is closer to the mathematical calculation.

We first have to understand the concepts of computer (computer) and computational (Compute).

At the level of the computer, the CPU executes the subtraction instruction code, as well as various conditional judgments and jump instructions, so, assembly language is the most close to the computer languages.

And the calculation of the exponential meaning, the more abstract calculation, the farther away from the computer hardware.

corresponding to the programming language, is:1> The lower the language, the more close to the computer, low degree of abstraction, implementation efficiency, such as C language;

           2> The more advanced the language, the more close to the calculation, high degree of abstraction, inefficient execution, such as Lisp language.

Functional programming is a very high degree of abstraction of the programming paradigm, pure Functional programming language is written in a function without variables , so any function, as long as the input is determined, the output is OK, this pure function we call no

Side effects. In the case of programming languages that allow the use of variables, because of the variable state inside the function, the same input may get different output, so this function has side effects.

One of the features of functional programming is that it allows the function itself to be passed as a parameter to another function, and also allows a function to be returned!

Python provides partial support for functional programming. Because Python allows the use of variables,Python is not a purely functional programming language

Functional programming of Python

Related Article

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.