Initializing Class instance within a class
<p>the entire counter list of methods in side counter class do not work. I want setcap to set of cap, and check cap to see if each counter have reached their limit as hr min sec are what a clock should know i would like to initialize them inside the clock.</p>

<pre><code>import time

class counter():
    count = 0
    cap = 0
    def _init_(self):pass
    def reset(self):
        self.count = 0
    def increment(self):
        self.count += 1
    def setcap(self,x):
        print x
        self.cap = x
    def checkcap(self):
        if self.cap &gt; self.count:
            return False
        else:
            return True
class clock():
    _hr = counter()
    _min = counter()
    _sec = counter()
    def _init_(self):
        self._hr.setcap(23)
        self._min.setcap(59)
        self._sec.setcap(59)
    def manualreset(self):
        self._hr.reset()
        self._min.reset()
        self_sec.reset()
    def tick(self):
        if self._sec.checkcap():
            self._sec.reset()
            self._min.increment()
            if self._min.checkcap():
                self._min.reset()
                self._hr.increment()
                if self._hr.checkcap():
                    self._hr.reset()
        else:
            self._sec.increment()
newClock =  clock()

raw_input("Press enter to start clock")
while newClock._hr != 24:
    newClock.tick()
    print str(newClock._hr.count).zfill(2) + str(newClock._min.count).zfill(2) + str(newClock._sec.count).zfill(2)
</code></pre>

<p>One of the problems in your code is that your init functions are <em>init</em>.
Try using</p>

<pre><code>def __init__(self):
    pass
</code></pre>

<p>This should solve one of your problems</p>

python clock