Search the difference: Why this function defenition does'nt work?

husam h.jehadalwan at student.kun.nl
Sun Dec 23 12:42:16 EST 2001


Aahz Maruch wrote:

> In article <3C260A92.5030907 at student.kun.nl>,
> husam  <h.jehadalwan at student.kun.nl> wrote:
> 
>>I'm not trying to add string to a list of integeres. What I wanted to do 
>>is to add each argument of func2('a','b','c') to sum=['e']. Since sum is 
>>a list of chars, and the arguments are accessable as a sequence, one 
>>would expect that the addition operation would be correct. On the 
>>interactive shell, it is a trivial operation. But, only when i use it in 
>>the function defenition i get problems. Adding 'a' to ['b'] does not 
>>work, but adding list('a') to ['b'] it does, so, i thought that this 
>>might help my code, but converting the args to a list did not helpe 
>>either . I really didn't get yet!
>>
> 
> use list.append()
> 

I know that this works, but it does not help my understanding!




More information about the Python-list mailing list