I was under the assumption that everything in python was a refrence...

so if I code this:
lst = [1,2,3]
for i in lst:
   if i==2:
      i = 4
print lst

I though the contents of lst would be modified.. (After reading that
'everything' is a refrence.)
so it seems that in order to do this I need to code it like:

lst = [1,2,3]
for i in range(len(lst)):
   if lst[i] == 2:
      lst[i]=4
print lst

Have I misunderstood something?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to