我在 vim 中使用 pythoncomplete omnicompletion。当我直接实例化类时效果很好,例如
import numpy as np
x = np.ndarray(l)
然后 x 属性正确完成。
但我使用 numpy 和 matplotlib 所以通常使用工厂函数,即
x = np.zeros((2,2))
f = plt.figure()
ax = f.add_subplot(111)
有什么方法可以硬编码这些常用函数的返回类型,以便我可以在返回的对象上完成。(即设置一些matplotlib.pyplot.figure返回matplotlib.figure.Figure,np.zeros返回np.ndarray等的映射?