7

这些文档没有说明最大调试级别是多少。

我需要知道这一点。

4

2 回答 2

11

I went through httplib.py and the code is littered with the following statement:

if self.debuglevel > 0:

This means there are just two levels.

  1. debuglevel less than or equal to zero
  2. debuglevel greater than zero

Yes this could have been better documented.

Also any time you need to check such an information, you can easily look at the code. Here is my favorite approach to locate a source file for a particular module.

>>> import httplib
>>> httplib.__file__
'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.pyc'

Now you can just open the following file to go through it's source code

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py
于 2012-07-06T21:53:23.993 回答
2

正如我从httplib.py源代码中看到的,只有 2 个调试级别:

  • <=0 - 没有调试信息
  • 任何大于零的值 - 打开调试信息

这是一个典型的检查:

if self.debuglevel > 0:
        print "blablabla"
于 2012-07-06T21:56:13.233 回答