Thursday, September 20, 2012

Understanding Classes in Python

I love Python, but there are some things about Python that I've really been struggling with.  Mainly I'd been struggling with classes, __init__ and the use of self as an argument.  When I saw something like this:

class Introduction:
    def __init__ (self, name):
        self.name = name

I had a small stroke.  What does that mean?  What is the purpose of a class?  Why does "self" keep popping up everywhere?!  I just didn't get it, and every explanation I read was so technical and hard to understand.  Well, I'm an auditory learner so I went to YouTube to see if anyone had explained it.  When I heard this man's tutorial, everything clicked.  If you're having trouble like I was, I think you should take the 12 minutes to watch and listen to this video.


~Melissa

No comments:

Post a Comment