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
ruoyu0088
V2EX  ›  Python

看 PyCon 2015 视频学习到的内容

  •  1
     
  •   ruoyu0088 · 2015-04-25 08:52:43 +08:00 · 4368 次点击
    这是一个创建于 3287 天前的主题,其中的信息可能已经有所发展或是发生改变。
    下面的表达式的结果是:

    False is False is False

    下面哪个更快? +=还是extend()?:

    ba = bytearray()

    ba += ....
    ba.extend(...)

    使用super()和多继承可以改变父类的搜索顺序。
    第 1 条附言  ·  2015-04-25 10:10:51 +08:00
    12 条回复    2015-04-25 20:41:45 +08:00
    pyKun
        1
    pyKun  
       2015-04-25 09:49:04 +08:00
    False is False is False 这个竟然是 True =,=
    c
        2
    c  
       2015-04-25 09:50:45 +08:00
    False is False is False -> True 求科普
    dofine
        3
    dofine  
       2015-04-25 10:01:13 +08:00   ❤️ 3
    @pyKun
    @c
    Chaining operators like a is b is c is equivalent to a is b and b is c. So the first example is False is False and False is False, which evaluates to True and True which evaluates to True Having parenthesis leads to the result of one evaluation being compared with the next variable (as you say you expect), so (a is b) is c compares the result of a is b with c.

    (http://stackoverflow.com/questions/28104393/why-does-false-is-false-is-false-evaluate-to-true)
    eeeeeeve
        4
    eeeeeeve  
       2015-04-25 10:03:48 +08:00
    视频链接在哪里?
    bcxx
        5
    bcxx  
       2015-04-25 10:04:35 +08:00   ❤️ 1
    @c
    @pyKun

    这个你按照 1 <= 1 <= 1 来了解
    bcxx
        6
    bcxx  
       2015-04-25 10:07:43 +08:00   ❤️ 1
    newghost
        7
    newghost  
       2015-04-25 10:16:07 +08:00
    ericls
        8
    ericls  
       2015-04-25 10:20:20 +08:00   ❤️ 1
    @c Python 就是这点爽

    可以直接写 1 <= 2 == 2 <= 3
    eeeeeeve
        9
    eeeeeeve  
       2015-04-25 10:30:50 +08:00
    @newghost 这些是ppt吧?
    reorx
        10
    reorx  
       2015-04-25 10:36:46 +08:00   ❤️ 2
    今年印象最深的是 Guido 关于 Diversity 的那一场,全程满槽点,给大家看我和小伙伴讨论时的截屏



    reorx
        11
    reorx  
       2015-04-25 10:44:11 +08:00   ❤️ 1
    laike9m
        12
    laike9m  
       2015-04-25 20:41:45 +08:00
    说实话,我认为这种 inconsistent 的东西没必要太纠结,说不定下个版本或另一个 Python 实现里就是另一种更快。倒是 Raymond 的那个 beyond pep8 演讲非常好,推荐去看。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5739 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 06:10 · PVG 14:10 · LAX 23:10 · JFK 02:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.