代码杂谈-or符号

看到别人的代码里用了 or, 有点巧用. 记录一下.

def func(a,b, context=None):
    # ....
    ctx = context or global_context()
    # ....
posted @ 2019-11-01 19:17  bregman  阅读(397)  评论(0编辑  收藏  举报