![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python基础语法
r4c12
这个作者很懒,什么都没留下…
展开
-
Python 装饰器 -- Decorators
Python 装饰器: Decoratorshttps://book.pythontips.com/en/latest/decorators.htmlPython 中的一切皆对象def hi(name="yasoob"): return "hi " + nameprint(hi())# output: 'hi yasoob'# We can even assign a function to a variable likegreet = hi# We are not usin原创 2020-07-07 17:39:49 · 169 阅读 · 0 评论 -
Python 链式比较
Python 链式比较在 Python 中有时候可以看到类似 a < b < c 的比较表达式写法,这与数学意义上的比较是一致的,但是和 a < b and b < c 还是有一点区别的。如在 a < f(x) < c 中,如果 a < f(x) 返回 False,则不会进行 f(x) 与 c 的比较而直接返回 False,这与 a < f(x) and f(x) < c 是一致的。而如果 a < f(x) 返回 True,则还需要进行 f(x原创 2020-07-07 00:16:03 · 381 阅读 · 0 评论