V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
ikbear
V2EX  ›  Python

你是怎么调试Python代码的?

  •  
  •   ikbear ·
    ikbear · Jul 8, 2011 · 7229 views
    This topic created in 5419 days ago, the information mentioned may be changed or developed.
    特别是只用VIM这种文本编辑器写代码的条件下,你是怎么调试Python代码的?
    12 replies    1970-01-01 08:00:00 +08:00
    c
        1
    c  
       Jul 8, 2011
    logging & print
    ikbear
        2
    ikbear  
    OP
       Jul 8, 2011   ❤️ 1
    ikbear
        3
    ikbear  
    OP
       Jul 8, 2011
    看来是这里的howto入门更简单点http://docs.python.org/howto/logging.html
    reorx
        4
    reorx  
       Jul 8, 2011
    ikbear
        5
    ikbear  
    OP
       Jul 8, 2011
    @reorx 谢谢~
    qichangxing
        6
    qichangxing  
       Jul 9, 2011
    刷页面,看 Bug 信息。
    看控制台出错代码。
    shawiz
        7
    shawiz  
       Jul 9, 2011
    import pdb; pdb.set_trace()
    qichangxing
        8
    qichangxing  
       Jul 11, 2011
    以打印日志为荣 , 以单步跟踪为耻;
    以单元测试为荣 , 以人工测试为耻;
    ---
    Python 八荣八耻 http://wiki.woodpecker.org.cn/moin/
    blackbird
        9
    blackbird  
       Jul 11, 2011
    例如有一个数十个模块1000行以上的文本处理代码,
    比起对照日志,用调试器跟踪肯定更方便。
    sqbing
        10
    sqbing  
       Jul 18, 2011
    打日志,难道还有别的?
    est
        11
    est  
       Jul 18, 2011
    python -i
    dreampuf
        12
    dreampuf  
       Jul 18, 2011
    logging & unittest 与 debug 结合.
    何时使用看具体情况,如果新环境调试什么的,debug非常便捷.但是debug是打水漂,每次投入精力后并不能复用.
    而logging&unittest则是"为你的未来投资".复用,简单,清晰,而且可以递增.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2883 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 02:31 · PVG 10:31 · LAX 19:31 · JFK 22:31
    ♥ Do have faith in what you're doing.