美文网首页
【Python】magic methods

【Python】magic methods

作者: 盐果儿 | 来源:发表于2023-05-06 16:30 被阅读0次

When a function name is in the__function_name__format, it is a special method in Python that is used to define the behavior of an object. These methods are also known as "dunder" (short for "double underscore") methods or magic methods.

For example, the__init__method is a special method that is called when an object is created. It is used to initialize the object with default values or values passed in as arguments

相关文章

网友评论

      本文标题:【Python】magic methods

      本文链接:https://www.haomeiwen.com/subject/zxucsdtx.html