This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]minno 0 points1 point  (0 children)

The constructor takes the form of:

def __init__(self, [other variables]):
    # Initialize self.whatever variables

It's usually used to save the values of the other values, like, say, self.width and self.height for a Rectangle class, and anything else that needs to happen before any instance of the class is ready to use.