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

Luke LLoeffler at
Sat Dec 22 18:54:37 CET 2001

If you use a list index [0] that returns a single element of the type 
that that element is (which is what you want in this case).  But when 
you use the colon for slice notation, you are asking python to return a 
tuple of all the elements up to the zeroth element, which is no 
elements--an empty tuple.  Then you are trying to add a number to a 
tuple which is undefined.

More information about the Python-list mailing list