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

你是怎么调试Python代码的?

  •  
  •   ikbear ·
    ikbear · 2011 年 7 月 8 日 · 6994 次点击
    这是一个创建于 5301 天前的主题,其中的信息可能已经有所发展或是发生改变。
    特别是只用VIM这种文本编辑器写代码的条件下,你是怎么调试Python代码的?
    12 条回复    1970-01-01 08:00:00 +08:00
    c
        1
    c  
       2011 年 7 月 8 日
    logging & print
    ikbear
        2
    ikbear  
    OP
       2011 年 7 月 8 日   ❤️ 1
    ikbear
        3
    ikbear  
    OP
       2011 年 7 月 8 日
    看来是这里的howto入门更简单点http://docs.python.org/howto/logging.html
    reorx
        4
    reorx  
       2011 年 7 月 8 日
    ikbear
        5
    ikbear  
    OP
       2011 年 7 月 8 日
    @reorx 谢谢~
    qichangxing
        6
    qichangxing  
       2011 年 7 月 9 日
    刷页面,看 Bug 信息。
    看控制台出错代码。
    shawiz
        7
    shawiz  
       2011 年 7 月 9 日
    import pdb; pdb.set_trace()
    qichangxing
        8
    qichangxing  
       2011 年 7 月 11 日
    以打印日志为荣 , 以单步跟踪为耻;
    以单元测试为荣 , 以人工测试为耻;
    ---
    Python 八荣八耻 http://wiki.woodpecker.org.cn/moin/
    blackbird
        9
    blackbird  
       2011 年 7 月 11 日
    例如有一个数十个模块1000行以上的文本处理代码,
    比起对照日志,用调试器跟踪肯定更方便。
    sqbing
        10
    sqbing  
       2011 年 7 月 18 日
    打日志,难道还有别的?
    est
        11
    est  
       2011 年 7 月 18 日
    python -i
    dreampuf
        12
    dreampuf  
       2011 年 7 月 18 日
    logging & unittest 与 debug 结合.
    何时使用看具体情况,如果新环境调试什么的,debug非常便捷.但是debug是打水漂,每次投入精力后并不能复用.
    而logging&unittest则是"为你的未来投资".复用,简单,清晰,而且可以递增.
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2457 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:49 · PVG 23:49 · LAX 07:49 · JFK 10:49
    ♥ Do have faith in what you're doing.