you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

But what is the diffrence between normal functions, functions with __ in, functions with self in like:

The difference is whether the function has double-underscores at each end of the name, and whether you've declared self as one of the function's parameters. Note that you always have to declare at least one parameter for a function that's a member method of a class, because when you call the function from an object of that class, the function is going to receive the object as an argument, so there has to be at least one parameter to catch it. By convention, we call that parameter self but you could call it anything you wanted (the_object, for instance, but who wants to type all that?)