Python function (ii)

Source: Internet
Author: User
#名字空间: Holds the binding relationship of the name to the value


#名称空间分为三种


#内置名称空间: The Python interpreter comes with its own name, and the Python interpreter starts to generate



#全局名称空间: The name of the file-level definition is stored with the global namespace, which is generated when the Python file executes
#局部名称空间: Defines the name inside the function, the local namespace only takes effect when the function is called, and the function call ends

#三者的加载顺序: Local namespaces, global namespaces, built-in namespaces

#取值: Built-in namespaces, global namespaces, local namespaces

#闭包函数: functions are defined inside functions and become intrinsic functions,
#该内部函数包含对外部作用域, not a reference to the global role name word
#那么该内部函数成为闭包函数
#作用域: Scope of action
#全局作用域: The name of the built-in namespace and the global namespace belong to the global scope,
# can be referenced anywhere in the entire file, valid globally
#局部作用域: The name of the local namespace belongs to the local scope,
#只在函数内部可以被引用, partially effective
#闭包函数的特点:
# self-scoped
# Delay Calculation

#定义闭包函数的基本形式


# def external function name ():
# variables required for intrinsic functions
# def intrinsic function ():
# referencing external variables
# return intrinsic function

Python function (ii)

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.