"Vincent Davis" <vinc...@vincentdavis.net> wrote
Here is the start of my Applicant Class
class Applicant(object):
"quality is refers to the quality of the Applicant
observe refers to the accuracy of which they assess the
quality of the school"
I guess you intended those to be triple quotes?
def __init__(self, quality = 0, observe = 0):
self. quality = quality
self. observe = observe
def Quality(self, mean, sd):
print self,
self.quality = normalvariate(mean, sd)
print "--> %s" % self
Its normal to use lowercase letters to start a method name.
ot needed but convention. But of course you'd need to change
the name to avoid conflicts with the attribute.
Do you really want to priont self? That will say something
like "<main.Applicant instance at...>"
You could however provide a __str__ method that will print out
what you do want to see.
def Observe(self, mean, sd):
print self,
self. observe = normalvariate(mean, sd)
print "--> %s" % self
Or I could I guess do it this way, Is this better? I will only be
setting the quality and observe values once for each instance.
This is a class with only an __init__ method, that's usually a
suspicious sign. What does the class do?
BTW its also unusual to have verbs as attributes. (Unless
they are boolean flags and even then its better to make it
a question eg. doesObserve. Should your self.observe be
self.observation say?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor