V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
chuangbo
V2EX  ›  Python

似乎只有 Python 支持 50 < x < 100 这样 humanlty 的表达式,还有别的支持吗?

  •  
  •   chuangbo · Jun 19, 2012 · 4164 views
    This topic created in 5073 days ago, the information mentioned may be changed or developed.
    4 replies    1970-01-01 08:00:00 +08:00
    123456
        1
    123456  
       Jun 21, 2012
    c++
    bearice
        2
    bearice  
       Jun 21, 2012
    coffee script
    fline
        3
    fline  
       Jun 21, 2012
    有支持 x> 50> y 的么
    chuangbo
        4
    chuangbo  
    OP
       Jun 21, 2012
    @123456 c++ 不支持的。50 < 80 < 100 恰好能正确,因为 c++ 会先计算 50 < 80 = true, 再计算 true < 100,true 当作 1,所以整个表达式是 true。所以在计算 50 < 20 < 100 的时候,依然正确,因为 false < 100 成立。
    http://gist.github.com/2966157


    @bearice coffee 确实可以,赞!


    @fline python 支持,其实道理是一样的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3023 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 07:33 · PVG 15:33 · LAX 00:33 · JFK 03:33
    ♥ Do have faith in what you're doing.