pylist string representation def __repr__(self) "pylist([for in range(self numitems) repr(self items[ ]if self numitems " "])return the other method for converting an object to string has different purpose python includes function called eval that will take string containing an expression and evaluate the expression in the string for instanceeval(" + "results in and eval("[ , , ]"results in the list [ , , the repr function in python calls the __repr__ method on class this methodif definedshould return string representation of an object that is suitable to be given to the eval function in the case of the pylist classthe repr form of the string would be something like "pylist([ , , ])for the pylist sequence containing these items here is the code that accomplishes this it is nearly identical to the __str__ codeexcept that pylist prefixes the sequence notice that in both sects and that repr is called on the elements of the list calling repr is necessary because otherwise list containing strings like ["hi","there"would be converted to [hi,therein its str or repr representation cloning objects it is interesting to note that we now have method of making copy of an object if is pylist objectthen eval(repr( )is copy or clone of this object since all the items in the pylist object are also cloned by evaluating the representation of the objectcloning an object like this is called deep clone or deep copy of the object it is also possible to make what is called shallow copy of an object shallow copy occurs when the object is copiedbut items in the object are shared with the clone if we wish to create shallow copy of pylist object called xwe would write the following pylist([ , , ] pylist(xherey is shallow copy of because both and share the items and in most cases whether some items are shared or not probably doesn' matter in this case it doesn' matter if items are shared because and are integers and integers are immutable howeverif the shared items are mutablethen you may care about shallow or deep clones of objects when working with shallow clone of an object that contains mutable items the programmer must be aware that the items in the collection might change values without any call to method on the object this won' happen to deep clone of an object this copy belongs to 'acha