>> mylist.index('foo')
ValueError: 'foo' is not in list
You never actually added mydict to mylist, so the index
method tries to raise this error. The error contains the repr of the dict. The repr of the dict, of course, tries to look up its index
in the list that it isn't in, and this raises an exception, whose error message is calculated using the repr of the dict, which of course, tries to look up its index
in the list that it isn't in, and...