# study **Repository Path**: python_py/study ## Basic Information - **Project Name**: study - **Description**: python学习 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2017-08-07 - **Last Updated**: 2024-06-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #study python学习 ## 函数对象 def test(): print('2017-12-08') f = test f() # 2017-12-08 ### 函数对象`__name__`,可以获取函数名 test.__name__ # test f.__name__ # test ## 私有函数或参数,不让外部调用 `_xx`,`__xx`定义就可以了 ##参数组合 在Python中定义函数,可以用必选参数、默认参数、可变参数、关键字参数和命名关键字参数,这5种参数都可以组合使用。但是请注意,参数定义的顺序必须是:必选参数、默认参数、可变参数、命名关键字参数和关键字参数。 比如定义一个函数,包含上述若干种参数: ##作用域 类似__xxx__这样的为公开的或特殊变量 类似_xxx和__xxx这样的函数或变量就是非公开的(private),不应该被直接引用,比如_abc,__abc等;