[Tutor] Questions about classes

brandon w bbbgggwww at gmail.com
Tue Nov 13 03:49:12 CET 2012


I have been trying to understand classes. I have been studying from a book
I picked up recently.
I have two questions about them.

1. I saw in the book an assignment written like this:

class HumanBeing:
        def makeName(self, name):
                  *self.name = name*
*
*
Why is it not written like this?:

class HumanBeing:
        def makeName(self, name):
*                  name = self.name*
*
*
2. Why use a class in the first place? What is the purpose of constructing
a class instead of just writing a program with a bunch of functions?


Thanks,

Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121112/9e1da581/attachment.html>


More information about the Tutor mailing list