Dennis Lee Bieber wrote: > On Sun, 11 Dec 2005 22:00:55 -0500, shawn a <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>I havet these 2 files in the same dir. This is code im writing to learn >>pythong >>mkoneurl.py: >>#! /usr/bin/env python >> >>import make_ou_class >> >>run = make_ou_class.makeoneurl() > > > Okay, you've just defined a "run" object that contains an instance > of "makeoneurl"... What do you expect it to do? > Let's get the terminology right: sloppy terminology leads to sloppy thinking. The statement binds the name "run" to a newly-created "make_one_url" instance. Remember, "run" isn't an object, it's a reference to an object like all Python names. > >>==================================== >>make_ou_class.py: >> > > Well, first off... You need to /supply/ a placeholder for "self". > ALL methods of a class receive the instance as the first argument. So... > Again you need to be a little careful here, since we now have class methods and static methods to cloud the picture. So it would be more accurate to say that "instance methods are all automatically called with a reference to the instance as the first argument; it is conventional to use the name 'self' to refer to the instance". > [...]
regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list
