Re: modifying a list element from a function

2009-04-02 Thread Gabriel Genellina
En Mon, 30 Mar 2009 13:19:57 -0300, TP escribió: Adrian Dziubek wrote: Could you explain your high level goal for this? It looks like a very wicked way of doing things. Have You tried to read the list methods' documentation? Maybe there you find something you need (like list.index)? I have

Re: modifying a list element from a function

2009-03-30 Thread TP
Adrian Dziubek wrote: > Could you explain your high level goal for this? It looks like a very > wicked way of doing things. Have You tried to read the list methods' > documentation? Maybe there you find something you need (like > list.index)? Hello, I have a "disambiguation" function that modifi

Re: modifying a list element from a function

2009-03-27 Thread Aaron Brady
On Mar 27, 4:39 am, TP wrote: > Hi everybody, > > Be a the following list, containing list elements which second field is a > string. > > >>> a = [ [4, "toto"], [5, "cou"] ] > >>> a[0][1]="tou" > >>> a > > [[4, 'tou'], [5, 'cou']] > > OK. > > Now, I want: > * to do the same modification on the lis

Re: modifying a list element from a function

2009-03-27 Thread Adrian Dziubek
Could you explain your high level goal for this? It looks like a very wicked way of doing things. Have You tried to read the list methods' documentation? Maybe there you find something you need (like list.index)? -- Adrian -- http://mail.python.org/mailman/listinfo/python-list

Re: modifying a list element from a function

2009-03-27 Thread Kent
> * to do the same modification on the list "a" within a function > * not to hardcode in this function the position of the string in each >>> a = [ [4, "toto"], [5, "cou"] ] >>> def assign(element,pos,newValue): ... element[pos]=newValue ... >>> assign(a[0],1,'xxx') >>> print a [[4, 'xxx'],

Re: modifying a list element from a function

2009-03-27 Thread Peter Otten
TP wrote: > Hi everybody, > > Be a the following list, containing list elements which second field is a > string. > a = [ [4, "toto"], [5, "cou"] ] a[0][1]="tou" a > [[4, 'tou'], [5, 'cou']] > > OK. > > Now, I want: > * to do the same modification on the list "a" within a functi

modifying a list element from a function

2009-03-27 Thread TP
Hi everybody, Be a the following list, containing list elements which second field is a string. >>> a = [ [4, "toto"], [5, "cou"] ] >>> a[0][1]="tou" >>> a [[4, 'tou'], [5, 'cou']] OK. Now, I want: * to do the same modification on the list "a" within a function * not to hardcode in this functio