[Tutor] OOD - Another class question

James Reynolds eire1130 at gmail.com
Mon Mar 1 00:24:09 CET 2010

I have another question related to OOD. What I have is a module with one
parent class and two child classes. Some stuff is done to the object that is
passed to the function in one of the child classes and this then calls a
function from the global class passing local variables (from the child

When I do this, I am told: AttributeError: 'HillBuilder' object has no
attribute 'MountainBuilder'

The question is, what am I doing wrong?

Here is an example:

class MountainBuilder(object):
def __init__(self, mountain):
            self.mountain = mountain

      def pinetree_func(self, knoll)
            do stuff to knoll
            return knoll

      def mountain_func(self, hill)
            knoll = hill * 2
            pinetree = pintree_func(knoll)
            return hill

class HillBuilder(MountainBuilder):
def __init__(self, mountain):
              OptionLoad.__init__(self, mountain)

      def hill_func(self)
            hill= do stuff to self.mountain
            grassyknoll = MountainBuilder.mountain_func(hill)

            return grassy knoll

do stuff with grassy knoll
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100228/e7fb4631/attachment.html>

More information about the Tutor mailing list