indirectly addressing vars in Python

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Oct 1 17:49:53 CEST 2008


Chris Rebert a écrit :
> On Wed, Oct 1, 2008 at 7:53 AM, Ross <nobody at nospam.noway> wrote:
>> Forgive my newbieness - I want to refer to some variables and indirectly
>>  alter them.  Not sure if this is as easy in Python as it is in C.
>>
>> Say I have three vars: oats, corn, barley
>>
>> I add them to a list: myList[{oats}, {peas}, {barley}]
> 
> You mean:
> myList = [oats, peas, barley]
> 
> And you're not adding *variables* to a list, you're adding *values* 

s/values/references to objects/, actually

(snip)



More information about the Python-list mailing list