indirectly addressing vars in Python

2008-10-01 Thread Ross
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}] Then I want to past that list around and alter one of

Re: indirectly addressing vars in Python

2008-10-01 Thread Jeremy Sanders
Ross wrote: myList[1]= myList[1]+1 The problem is this makes myList[1] point to a new integer, and not the one that peas points to. Python 2.5.1 (r251:54863, Jul 10 2008, 17:25:56) [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 Type help, copyright, credits or license for more

Re: indirectly addressing vars in Python

2008-10-01 Thread Grant Edwards
On 2008-10-01, Ross [EMAIL PROTECTED] 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. Python doesn't have variables. It has names bound to objects. When you do an assignment, that binds (or

Re: indirectly addressing vars in Python

2008-10-01 Thread Chris Rebert
On Wed, Oct 1, 2008 at 7:53 AM, Ross [EMAIL PROTECTED] 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},

Re: indirectly addressing vars in Python

2008-10-01 Thread Bruno Desthuilliers
Chris Rebert a écrit : On Wed, Oct 1, 2008 at 7:53 AM, Ross [EMAIL PROTECTED] 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:

Re: indirectly addressing vars in Python

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 10:53:08 -0400, Ross 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}]