Python中具有多个可选预定义参数的方法
我总是找到具有多个预定义参数的方法非常友好,例如:
plt.plot([1,2,3], [5,1,2], color = "black", linewidth=10)
在此示例中参数是未定义的(** kwargs)
。 如图所示的参数的建议伴随着使用的简单性: 建议的参数 我试图探索方法.plot(),它使我进入了一个深兔子孔。问题是,您将如何实施这种行为?
I always find very user-friendly the methods with multiple predefined parameters such as:
plt.plot([1,2,3], [5,1,2], color = "black", linewidth=10)
In this example the order of the arguments color
and linewidth
is indifferent, in addition the type of the arguments is undefined (**kwargs)
.
The easiness of use comes with the suggestion of parameters as shown in the picture:
Suggested parameters
I tried to explore the method .plot() and it lead me into a deep rabbit hole. The question is, how would you implement such a behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论