recursion within list can serve to make the list or string smaller in that case it may be helpful to write function that calls helper function to do the recursion consider the program in sect this code uses nested helper function called revlisthelper to do the actual recursion the list itself does not get smaller in the helper function insteadthe index argument gets smallercounting down to - when the empty list is returned the revlist function contains only one line of code to call the revlisthelper function because the revlisthelper function is nested inside revlist the helper function is not visible to anything but the revlist function since we don' want other programmers to call the helper function except by calling the revlist function first it is important to note that you don' have to physically make list or string smaller to use it in recursive function as long as indexing is available to youa recursive function can make use of an index into list or string and the index can get smaller on each recursive call one other thing to note in this example the index gets smaller by approaching zero on each recursive call there are other ways for the argument to the recursive function to get smaller for instancethis example could be rewritten so the index grows toward the length of the list in that case the distance between the index and the length of the list is the value that would get smaller on each recursive call using type reflection many of the similarities in the two functions of sects and are due to operator overloading in python python has another very nice feature called reflection reflection refers to the ability for code to be able to examine attributes about objects that might be passed as parameters to function one interesting aspect of reflection is the ability to see what the type of an object is if we write type(objthen python will return an object which represents the type of obj for instanceif obj is reference to stringthen python will return the str type object furtherif we write str(we get string which is the empty string in other wordswriting str(is the same thing as writing "likewisewriting list(is the same thing as writing [using reflectionwe can write one recursive reverse function that will work for stringslistsand any other sequence that supports slicing and concatenation recursive version of reverse that will reverse both strings and lists is provided in sect reflection reverse def reverse(seq)seqtype type(seqemptyseq seqtype( this copy belongs to 'acha