Changes in getting started with list. Elaborating some points as suggested in review
authorAmit Sethi
Thu, 11 Nov 2010 12:19:32 +0530
changeset 466 00c1ba1cb9ef
parent 451 c61ed190af5e
child 467 501383b753c1
Changes in getting started with list. Elaborating some points as suggested in review
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.      
+
+
+