Python: Functions
Revlekt (Inspiration)
- 章节名:Python: Functions
* parameter vs. argument parameter: names given in the function definition argument: values supply in the function call * pass by value? * global statement tell python the varible is actually defined in an OUTERMOST block * nonlocal statement * scope 作用域 与javascript类似,python没有block级作用域,但是有函数级作用域 def scope(): i='i' if True: j='j' if True: k = 'k' print(k) # k is available here print(j) # j is available here scope() print(i) # i is not available here * default argument values the arguments which have the default values should be place at the end of the parameter list * keyword arguments when calling a function, you can specify the name of the argument * ? varArgs parameters * documentation string a string on the first logical ine of a function. use funcName.__doc__ to retrieve
Revlekt对本书的所有笔记 · · · · · ·
-
Python: Basics
literal constants * there's no long int type for python3. namely following is not allow...
-
Python: Control Flow
* if, elif * no switch statement * "while" statement can have an optioinal "else" claus...
-
Python: Functions
说明 · · · · · ·
表示其中内容是对原文的摘抄