iterating initalizations

r rt8396 at gmail.com
Mon Dec 22 22:15:20 EST 2008


I can't check you code because i don't have these modules but here is
the code with proper indention

import random
from rtcmix import *
from chimes_source import *
from rhythmblock import *
from pitchblock import *
indexrand = random.Random()
indexrand.seed(2)
rhythm = rhythmBlock()
pitch = pitchBlock()

class pitchAndRhythm:
    def __init__(self):
        self.__abet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    def listCreate(self, num):
        if num > 25:
            print "Oops.  This won't work"
        else:
            for a in range(num):
                b = indexrand.randint(0, 3)
                c = indexrand.randint(0, 7)
                index = self.__abet[a]
                index = [ ]
                index = index.append(rhythm.rhythmTwist(b, c))

take 2: notice the "(" and ")" around the arg to __init__



More information about the Python-list mailing list