V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
YUX
V2EX  ›  问与答

Python 里的 if f(x) and g(x): 这句, 若 f(x)为 False,还会计算 g(x)么?

  •  
  •   YUX · 2020-03-28 20:45:16 +08:00 · 688 次点击
    这是一个创建于 1482 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如果 python 里的 if f(x) and g(x): 这句, 若 f(x)为 False,还会计算 g(x)么?

    Trim21
        1
    Trim21  
       2020-03-28 20:48:48 +08:00
    python -c '0 and print(233)'
    不会
    jingniao
        2
    jingniao  
       2020-03-28 20:56:27 +08:00 via iPhone
    哪个语言 or and 是计算全部?
    Muninn
        3
    Muninn  
       2020-03-28 21:06:22 +08:00
    我会的语言都不会
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3168 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:52 · PVG 18:52 · LAX 03:52 · JFK 06:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.