Hi all:

I'm new to python and trying to save time and code by iterating through list initializations as well as the assignments. I have the following code:

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))


This doesn't do what I expect (probably because I don't have a clue what I'm doing!): initalizing, then filling new arrays, each new one called A[ ], then B[ ], etc.

This seems very un-pythonic, and I'm sure there is a right way to do it. I'm just lost!

Thanks

Aaron Stepp
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to