Python __doc__ 行为 2.6 对比 2.7
Python __doc__ behavior 2.6 vs 2.7
如果我有以下代码:
def foo(x, y):
return x * y
t1 = lambda a, b: foo(x=a, y=b)
print t1.__doc__
2.6 中的输出:
x
2.7 中的输出:
None
虽然 2.7 中的行为看起来很准确,但我无法找到此更改行为的错误或更改请求。有人可以投更多的灯或 link 我来处理这个的变更请求吗?
这是 Python issue 8164. String constants used by a lambda's code were incorrectly getting interpreted as docstrings. This was fixed 使 None
成为 lambda 代码中的第一个常量。
如果我有以下代码:
def foo(x, y):
return x * y
t1 = lambda a, b: foo(x=a, y=b)
print t1.__doc__
2.6 中的输出:
x
2.7 中的输出:
None
虽然 2.7 中的行为看起来很准确,但我无法找到此更改行为的错误或更改请求。有人可以投更多的灯或 link 我来处理这个的变更请求吗?
这是 Python issue 8164. String constants used by a lambda's code were incorrectly getting interpreted as docstrings. This was fixed 使 None
成为 lambda 代码中的第一个常量。