Ok, it’s starting to get pretty complex! As best as I can understand it at the moment, a
class is a a sort of super structure that can be used more flexibly than can a simple function, that other variables and structures can be flexibly swapped in and out of. I am fairly lost on a good amount of the syntax, like the
__init__ and the
self.name = name, to name a few. But I’ve decided to go ahead and start copying in the code for this exercise, though I don’t entirely understand it yet. Evidently it always takes a long time to really grok OOP. So that’s ok.
Some things I notice: The classes call a generic object seem to be hierarchically above others, e.g.
class Scene(object) (rather than
class Death(Scene) which calls
Scene()). I don’t know if this is important or not, but it is how Zed’s exercise is going.
And at this point, I’ve pushed through, even not being totally sure of what I’m doing, and punched in all the code, learning snippets here and there, and I’ve checked it all over, and it doesn’t run. I am frustrated. I have read the last few exercises several times where he has started discussing classes and object-oriented programming, and I’m really not getting the hang of it. Someone told me, when I shared that I was trying to start learning what the meat and potatoes of modern programming, OOP, really is, that it took learning another language before he really grokked what the deal was. Barring that, I just keep trying to read about it. I know I can get it, but I don’t have it right now, and I can’t finish this lesson of LPTHW, and I’m frustrated. So I shall move on and try to come back later.
We will discuss soon. OOP, like you said, is tough to grok at first, but once you get over the conceptual hump, it makes a lot of sense. The problem is that the syntax is usually terrible, so it’s really tough to figure it out from there. I didn’t really get OOP until I learned a SECOND OO language.
I think I am getting there!