Python, __init__ and self confusion

前端 未结 5 540
别跟我提以往
别跟我提以往 2021-01-20 02:48

Alright, so I was taking a look at some source when I came across this:

>>> def __parse(self, filename):
...         \"parse ID3v1.0 tags from MP3 f         


        
5条回答
  •  耶瑟儿~
    2021-01-20 03:17

    self is passed in automatically by the instancemethod wrapper on classes. This function isn't wrapped; it's not a method, it's just a function. It doesn't even make sense without being attached to a class, since it needs the self parameter.

提交回复
热议问题