iterating initalizations
Aaron Stepp
stepp.aaron at gmail.com
Mon Dec 22 22:52:35 EST 2008
On Dec 22, 2008, at 10:43 PM, Chris Rebert wrote:
> On Mon, Dec 22, 2008 at 7:32 PM, Aaron Stepp <stepp.aaron at gmail.com>
> wrote:
> <snip>
>>
>> Thanks for the help so far, I think I'm starting to get a hang of the
>> syntax.
>>
>> I think I need to state my goal more clearly.
>>
>> Instead of writing a long list of initializations like so:
>>
>> A = [ ]
>> B = [ ]
>> ...
>> Y = [ ]
>> Z = [ ]
>>
>> I'd like to save space by more elegantly turning this into a loop.
>> If I
>> need to just write it out, I guess that's ok... but it would be much
>> cleaner. I'm a composer, not a programmer, so some of this is
>> quite above
>> me.
>>
>
> So, are these variables supposed to be module-level, or attributes of
> class pitchAndRhythm, or what?
> Also, are you going to use the variables normally or are you going to
> need "variable variables" (e.g. like $$var in PHP, which gives the
> value of the variable with the name of the string stored in $var)?
>
> Cheers,
> Chris
>
> --
> Follow the path of the Iguana...
> http://rebertia.com
The're going to only be part of the pitchAndRhythm class. Simply put,
I just need enough arrays to hold a list of pitches/rhythms. Then
I'll have each list member returned to an instrument defined in
another module.
As I'm hacking away at the code, I'm realizing that maybe I can do
this with just and A = [] and B = []. But I'm not sure...
Thanks again.
AS
More information about the Python-list
mailing list