iterating initalizations

Aaron Stepp stepp.aaron at
Mon Dec 22 23:22:56 CET 2008

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

rhythm = rhythmBlock()
pitch = pitchBlock()

class pitchAndRhythm:

	def __init__self:


def listCreate(self, num):

	if num > 25:

		print "Oops.  This won't work"


		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!


Aaron Stepp

More information about the Python-list mailing list