On 13/11/2012 02:49, brandon w wrote:
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


This is not a Python question, so please do some research into something like object orientated vs functional vs procedural programming styles. When you've read and misunderstood, come back and ask again, and we'll explain The Zen of Python, specifically "practicality beats purity" :)

--
Cheers.

Mark Lawrence.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to