V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2012-06-19 14:40:41 +08:00 · 3393 次点击
    这是一个创建于 4322 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    1970-01-01 08:00:00 +08:00
    123456
        1
    123456  
       2012-06-21 16:44:33 +08:00
    c++
    bearice
        2
    bearice  
       2012-06-21 17:43:38 +08:00
    coffee script
    fline
        3
    fline  
       2012-06-21 17:49:35 +08:00
    有支持 x> 50> y 的么
    chuangbo
        4
    chuangbo  
    OP
       2012-06-21 22:52:23 +08:00
    @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 支持,其实道理是一样的。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1218 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:07 · PVG 02:07 · LAX 11:07 · JFK 14:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.