十. Python基础(10)--装饰器 1 ● 装饰器 A decorator is a function that take a function as an argument and return a function. We can use a decorator to extend the functionality of an existing function without changing its source. Decorators are syntactic sugar.…
入门知识: 一.关于作用域: 对于变量的作用域,执行声明并在内存中存在,该变量就可以在下面的代码中使用. if 10 == 10: name = 'allen' print name 以下结论对吗? 外层变量,可以被内层变量使用 内层变量,无法被外层变量使用 以上结论,对于其他语言适用,对于python 不适用 ** 记住:python,只要内存里存在,则就能适用 (栈 ) 二.三元运算: 1).普通循环: if name == "test": name = "坏人"…