Python Beginner 18th Day function (3)

Source: Internet
Author: User

18day

Function

1. Scope

In Python, a function is a scope. All local variables are placed in the current scope.

After the code definition is complete, the scope is generated, and the scope chain looks up

2. anonymous function

When a function needs to be used temporarily, it is no longer used after it is exhausted. An anonymous function (lambda) can be declared.

Lambda functions: Save code, and you can no longer need to define a function to use with other methods. such as map ()

3. High-order function

A variable can point to a function, which can receive a variable, and a function can receive another function function as a parameter, a function called a higher order function.

Satisfies any one of the following conditions, which is a higher order function

A, accept one or more functions as input

B, return returns another function

4. Recursive function

function to call the function itself again

Python Beginner 18th Day function (3)

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.