[Tutor] Why are arguments sometimes on the left side?
Michael Scharf
mnshtb at gmail.com
Mon Sep 20 17:04:49 CEST 2010
Okay, we now have a dog named Fluffy, which is just one instance of
> our dog class. With the way you would want to do things, I would have
> to say
> bark(f)
> But what is bark? Where is it defined? You can see it is in the dog
> class, but Python cannot; you passed a dog instance to bark(), but
> that will not tell Python to search in the dog class to find the bark
> method. Saying
> f.bark()
> will work since it tells Python:
> take this instance of dog, called f, and call its bark method. The
> bark method is in the dog class since bark is being called on a dog
> object (remember that an object is just an instance of a class).
> I hope this made some sense. <http://www.facebook.com/mehgcap>
This is terrific --- very clarifying. Thank you so much.
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100920/b0fa3c24/attachment.html>
More information about the Tutor
mailing list