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

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

  •  
  •   Newyorkcity · 2017-01-25 19:05:58 +08:00 · 1676 次点击
    这是一个创建于 2670 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2017-01-25 19:46:34 +08:00
    3pmtea
        1
    3pmtea  
       2017-01-25 19:29:45 +08:00   ❤️ 1
    -- 为什么输出的文本是按(与函数名出现的顺序)相反的顺序打印出来的?
    -- 准确来说并不是反序,而是(按照函数的调用层次)从里向外的顺序

    比如 31 行, what = add(age, subtract(height, multiply(weight, divide(iq, 2)))),函数出现的顺序(正序)是 add - sub - mult - divide ,而在实际执行代码时, python 先确定参数的值,然后才调用函数,这就导致了在最内层的 divide 会最先调用,所以就成了 inside-out
    Newyorkcity
        2
    Newyorkcity  
    OP
       2017-01-25 19:46:34 +08:00
    @3pmtea 谢谢,理解了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2104 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:41 · PVG 19:41 · LAX 04:41 · JFK 07:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.