使用跟踪模块,对于具有很多。很多我得到一个非常奇怪的结果,它告诉我,我调用的每个函数都是__init__
,我调用的每个模块都是__future__
。你知道吗
应用程序的调用如下所示:
python -m trace option foo |tee logfile
其中选项是-t、-t或-l。 -l不产生输出。你知道吗
-t的输出如下所示:
foo(6): from __future__ import print_function
--- modulename: __future__, funcname: <module>
__future__.py(48): """
__future__.py(51): "nested_scopes",
__future__.py(52): "generators",
__future__.py(53): "division",
__future__.py(54): "absolute_import",
__future__.py(55): "with_statement",
__future__.py(56): "print_function",
__future__.py(57): "unicode_literals",
__future__.py(60): __all__ = ["all_feature_names"] + all_feature_names
__future__.py(66): CO_NESTED = 0x0010 # nested_scopes
__future__.py(67): CO_GENERATOR_ALLOWED = 0 # generators (obsolete, was 0x1000)
__future__.py(68): CO_FUTURE_DIVISION = 0x2000 # division
__future__.py(69): CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default
__future__.py(70): CO_FUTURE_WITH_STATEMENT = 0x8000 # with statement
__future__.py(71): CO_FUTURE_PRINT_FUNCTION = 0x10000 # print function
__future__.py(72): CO_FUTURE_UNICODE_LITERALS = 0x20000 # unicode string literals
__future__.py(74): class _Feature:
--- modulename: __future__, funcname: _Feature
__future__.py(74): class _Feature:
__future__.py(75): def __init__(self, optionalRelease, mandatoryRelease, compiler_flag):
__future__.py(80): def getOptionalRelease(self):
__future__.py(88): def getMandatoryRelease(self):
__future__.py(97): def __repr__(self):
__future__.py(102): nested_scopes = _Feature((2, 1, 0, "beta", 1),
__future__.py(103): (2, 2, 0, "alpha", 0),
__future__.py(104): CO_NESTED)
--- modulename: __future__, funcname: __init__
__future__.py(76): self.optional = optionalRelease
__future__.py(77): self.mandatory = mandatoryRelease
__future__.py(78): self.compiler_flag = compiler_flag
__future__.py(106): generators = _Feature((2, 2, 0, "alpha", 1),
__future__.py(107): (2, 3, 0, "final", 0),
__future__.py(108): CO_GENERATOR_ALLOWED)
--- modulename: __future__, funcname: __init__
__future__.py(76): self.optional = optionalRelease
__future__.py(77): self.mandatory = mandatoryRelease
__future__.py(78): self.compiler_flag = compiler_flag
__future__.py(110): division = _Feature((2, 2, 0, "alpha", 2),
__future__.py(111): (3, 0, 0, "alpha", 0),
__future__.py(112): CO_FUTURE_DIVISION)
--- modulename: __future__, funcname: __init__
__future__.py(76): self.optional = optionalRelease
__future__.py(77): self.mandatory = mandatoryRelease
__future__.py(78): self.compiler_flag = compiler_flag
__future__.py(114): absolute_import = _Feature((2, 5, 0, "alpha", 1),
__future__.py(115): (3, 0, 0, "alpha", 0),
__future__.py(116): CO_FUTURE_ABSOLUTE_IMPORT)
--- modulename: __future__, funcname: __init__
__future__.py(76): self.optional = optionalRelease
__future__.py(77): self.mandatory = mandatoryRelease
__future__.py(78): self.compiler_flag = compiler_flag
__future__.py(118): with_statement = _Feature((2, 5, 0, "alpha", 1),
__future__.py(119): (2, 6, 0, "alpha", 0),
__future__.py(120): CO_FUTURE_WITH_STATEMENT)
--- modulename: __future__, funcname: __init__
__future__.py(76): self.optional = optionalRelease
__future__.py(77): self.mandatory = mandatoryRelease
__future__.py(78): self.compiler_flag = compiler_flag
__future__.py(122): print_function = _Feature((2, 6, 0, "alpha", 2),
__future__.py(123): (3, 0, 0, "alpha", 0),
__future__.py(124): CO_FUTURE_PRINT_FUNCTION)
--- modulename: __future__, funcname: __init__
__future__.py(76): self.optional = optionalRelease
__future__.py(77): self.mandatory = mandatoryRelease
__future__.py(78): self.compiler_flag = compiler_flag
__future__.py(126): unicode_literals = _Feature((2, 6, 0, "alpha", 2),
__future__.py(127): ...
-T使用从模块__future__
调用的所有函数__init__
生成类似的输出。
如何生成程序的合理跟踪?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐