That's deliberate. The original code (before incorporation into Python) had warn(), which was kept for backward compatibility. The docs refer to warning() because that's what everyone is supposed to use. The method names map to the lower case of the appropriate logging level name.
自从Python 3.3以来,
logging.warn
已被弃用,您应该使用logging.warning
。在Python 3.3之前,
logging.warn
和logging.warning
是相同的函数,但是logging.warn
没有文档记录,如Python bug trackerhttp://bugs.python.org/issue13235中的一个封闭问题所述:保留
logging.warn()
是为了向后兼容,但是a deprecation warning was added。logging.warning()
是每个人都应该使用的。在Python 3.3之前,它们是相同的,但是
warn
被弃用:相关问题 更多 >
编程相关推荐