0
我有這段Python代碼。在案例A中,我沒有收到文檔字符串,但在案例B中,我明白了。Python jedi代碼完成:如何獲取doc字符串
請告訴我讓它在Case A.工作。謝謝。
from jedi import Script, Interpreter
import math
# Case A
completions = Interpreter(source="math.sin(0)", line=1, column=7, namespaces=[{'math': math}]).completions()
for x in completions:
print(x.docstring()) # Bad. The doc string is always empty.
# Case B
completions = Script(source='import math\nmath.sin(0)', line=2, column=7).completions()
for x in completions:
print(x.docstring()) # Good. Got the doc string.
我目前正在修改Interpreter完成,因爲它有很多問題。 在兩個月內找回我! –