# HG changeset patch # User Amit Sethi # Date 1289458172 -19800 # Node ID 00c1ba1cb9efb5ccd98206b8266b349cefb1a4fa # Parent c61ed190af5e22f293ec503397b4e0ea37492e43 Changes in getting started with list. Elaborating some points as suggested in review diff -r c61ed190af5e -r 00c1ba1cb9ef getting-started-with-lists/script.rst --- a/getting-started-with-lists/script.rst Thu Nov 11 01:43:26 2010 +0530 +++ b/getting-started-with-lists/script.rst Thu Nov 11 12:19:32 2010 +0530 @@ -153,7 +153,7 @@ deletes the element at index 1, i.e the second element of the list, 'eggs'. The other way is removing element by content. Lets say one wishes to delete 100 from nonempty list the syntax of the command -should be +would be .. #[[Anoop: let x = [1,2,1,3] now x.remove(x[2]) @@ -178,6 +178,21 @@ thus remove removes the first occurence of the element in the sequence and leaves others untouched. +One should remember this that while del removes by index number. +Remove , removes on the basis of content being passed so if :: + + k = [1,2,1,3] + del([k[2]) + +gives us [1,2,3]. :: + + k.remove(x[2]) + +will give us [2,1,3]. Since it deletes the first occurence of what is +returned by x[2] which is 1. + + +