推荐学习书目
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
Newyorkcity
V2EX  ›  Python

请问这里的 backward 和 inside out 是想表达什么?谢谢

  •  
  •   Newyorkcity · Jan 25, 2017 · 2340 views
    This topic created in 3421 days ago, the information mentioned may be changed or developed.

    Q : Why does Python print the formula or the functions "backward"?
    A : It's not really backward, it's "inside out." When you start breaking down the function into separate formulas and function calls you'll see how it works. Try to understand what I mean by "inside out" rather than "backward."
    from : https://learnpythonthehardway.org/book/ex21.html

    2 replies    2017-01-25 19:46:34 +08:00
    3pmtea
        1
    3pmtea  
       Jan 25, 2017   ❤️ 1
    -- 为什么输出的文本是按(与函数名出现的顺序)相反的顺序打印出来的?
    -- 准确来说并不是反序,而是(按照函数的调用层次)从里向外的顺序

    比如 31 行, what = add(age, subtract(height, multiply(weight, divide(iq, 2)))),函数出现的顺序(正序)是 add - sub - mult - divide ,而在实际执行代码时, python 先确定参数的值,然后才调用函数,这就导致了在最内层的 divide 会最先调用,所以就成了 inside-out
    Newyorkcity
        2
    Newyorkcity  
    OP
       Jan 25, 2017
    @3pmtea 谢谢,理解了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   979 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:35 · PVG 03:35 · LAX 12:35 · JFK 15:35
    ♥ Do have faith in what you're doing.