On Fri, May 2, 2008 at 2:20 PM, W W <[EMAIL PROTECTED]> wrote: > I knew/guessed the alias bit from my experience with C++, but I > couldn't figure out exactly what I needed. I've seen the "self" > reference before, but I never really understood it.
'self' is roughly like 'this' in C++. Unlike C++, self must be explicit - it is listed as a method parameter and it must be used for attribute access. > Let me see if I > understand correctly: > > class myClass(): or, more idiomatic (class names start with upper case letters) and modern (inherit from object to create a new-style class): class MyClass(object): > > creates a new "data type"(?), called myClass, and > > x = myClass() > > creates a variable with the type of "myClass", similar to foo = dict() > > and the method inside myClass defined as myMethod(self), can be called > on the data type "myClass" like this: > > x.myMethod() > > is that fairly accurate? Yes. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor