It's a little #clearer what's going on here if you put it this way:
>>> b = []
>>> b.append(b)
>>> b
[[...]]
>>> b is b[0]
True
So all you've done is create a #list, and then #append (not extend) that list to itself. Since `a` and `a[0]` are the same #object, the `in` test will return True either way.
#clearer #list #append #object