当前位置 : 主页 > 编程语言 > python >

Python return self

来源:互联网 收集:自由互联 发布时间:2022-06-15
在Python中,return self的作用为: Returning self from a method simply means that your method returns a reference to the instance object on which it was called. This can sometimes be seen in use with object oriented APIs that are des

在Python中,return self的作用为:

Returning self from a method simply means that your method returns a reference to the instance object on which it was called. This can sometimes be seen in use with object oriented APIs that are designed as a fluent interface that encourages method cascading.

链式调用




上一篇:Python Type Hints(类型提示)
下一篇:没有了
网友评论