On Wed, 2006-09-13 at 18:26 -0400, Kent Johnson wrote:
> Chris Hengge wrote:
> > The deitel book has a note on page 229:
> >     Failure to specify an object reference (usually called self) as the
> > first parameter in a method definition causes fatal logic errors when
> > the method is invoked at runt-ime.
> > 
> > Now I've got methods all over the place among several scripts that don't
> > use self, and each other works fine as I'd expect. 
> 
> You have to distinguish between a method (a function that is part of a 
> class definition) and a standalone function (not part of any class). 
> Python allows both. Standalone functions don't have a 'self' parameter; 
> class methods always do (you can give it a different name but if you 
> omit it you will get a runtime error when you call the method).
> 
> Kent
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

So just make sure I always declare self for methods (functions in
classes)? Is this unique to python? or do some other languages already
include self, and just hide it from the programmer? 

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to