Re: Append Problem

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 10:46 AM, Steve Holden wrote: > > See the .sig. Of course I'm a businessman. > Nice site! In that case, respectfully I disagree! beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Append Problem

2010-01-02 Thread Steve Holden
Victor Subervi wrote: [...] > While the learning you have performed in getting this system to work > (for some rather questionable value of "work", I can't help feeling, but > we'll overlook the horrors induced by your lack of programming > experience) is a testament to your persist

Re: Append Problem

2010-01-02 Thread Victor Subervi
There isn't a tuple is sight there - you are dealing with lists, and you > are modifying the very list you are iterating over. > > Try rewriting the code to create a new list from the old one (i.e. > iterate over catChains and have your code append to an initially empty > list called, for example,

Re: Append Problem

2010-01-02 Thread Steve Holden
Victor Subervi wrote: > Hi; > I have the following code snippet: > > print 'Original: ', catChains, '' > while i < MAXLEVEL: > flag = 0 > j = 0 > while j < len(parents): > for chain in catChains: > if parents[j] == chain[len(chain)-1]: > chain.append(childre

Append Problem

2010-01-02 Thread Victor Subervi
Hi; I have the following code snippet: print 'Original: ', catChains, '' while i < MAXLEVEL: flag = 0 j = 0 while j < len(parents): for chain in catChains: if parents[j] == chain[len(chain)-1]: chain.append(children[j]) print '1: ', catChains, ''