[Tutor] variable name based on variables (expansion?)

2005-02-28 Thread John Christian
a python 2.3 noob asks: # I have some lists GameLogic.varList0=[1,1,1,1] GameLogic.varList1=[1,1,1,1] GameLogic.varList3=[1,1,1,1] # I want to change specific list elements GameLogic.varList0[2]=0 print GameLogic.varList0 [1,1,0,1] # But I want the assignment # to be based on variables LIST=1

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Martin Walsh
John Christian wrote: # But I want the assignment # to be based on variables LIST=1 POSITION=2 GameLogic.varList$LIST[$POSITION]=0 help(getattr) Help on built-in function getattr: getattr(...) getattr(object, name[, default]) - value Get a named attribute from an object; getattr(x, 'y')

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Bill Mill
John, On Mon, 28 Feb 2005 06:05:44 -0800 (PST), John Christian [EMAIL PROTECTED] wrote: a python 2.3 noob asks: # I have some lists GameLogic.varList0=[1,1,1,1] GameLogic.varList1=[1,1,1,1] GameLogic.varList3=[1,1,1,1] # I want to change specific list elements GameLogic.varList0[2]=0