推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
jacklong
V2EX  ›  Python

pid = user and user.id or False

  •  
  •   jacklong ·
    jack-long · Feb 4, 2015 · 3340 views
    This topic created in 4252 days ago, the information mentioned may be changed or developed.

    python中逻辑运算从左到右进行,and运算返回第一个假值,若都为真则返回最后一个真值。or运算返回第一个真值,若都为假则返回最后一个假值。

    ryd994
        1
    ryd994  
       Feb 5, 2015 via Android   ❤️ 1
    乖乖用括号……
    你这样除了给其他人考语法之外,没有任何意义
    jacklong
        2
    jacklong  
    OP
       Feb 5, 2015
    @ryd994 Readability counts.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2686 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 01:42 · PVG 09:42 · LAX 18:42 · JFK 21:42
    ♥ Do have faith in what you're doing.