class StrList(list):

    def __str__(self):
        string = '['
for index, item in enumerate(self):
    string += str(item)
if index != len(self) - 1:
    string += ', '
return string + ']'


class myClass(object):

    def __str__(self):
        return 'myClass'

def __repr__(self):
    return object.__repr__(self)
Using __str__ representation for printing objects in containers in Python