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

被调用函数如何才能知道自己是被哪个函数调用的?

  •  
  •   zyAndroid · Sep 10, 2011 · 6082 views
    This topic created in 5368 days ago, the information mentioned may be changed or developed.
    比如A函数和B函数都可能调用C函数来完某个功能
    C函数内部是否有内置的变量记录了调用它的函数的信息,比如函数名什么的?

    求解!
    3 replies    1970-01-01 08:00:00 +08:00
    lhj2100
        1
    lhj2100  
       Sep 10, 2011
    我们这些初学者都是用数组的.
    qiao
        2
    qiao  
       Sep 10, 2011
    使用 inspect 模块的 getouterframes 方法。

    文档参见:
    http://docs.python.org/library/inspect.html#inspect.getouterframes
    zyAndroid
        3
    zyAndroid  
    OP
       Sep 10, 2011
    @qiao Thanks!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5343 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 05:54 · PVG 13:54 · LAX 22:54 · JFK 01:54
    ♥ Do have faith in what you're doing.