How does Python (2.6.4, specifically) determine list membership in general? I\'ve run some tests to see what it does:
def main():
obj = fancy_obj(arg=\'
Python is using the (equivalent of) the == operator. If the fancy_obj class does not define __eq__ (or the crufty old __cmp__, still supported for backwards compatibility) then equality, ==, "falls back" to identity, is, and that appears to be what's happening here.
The relevant docs are here, and I quote:
x in s True if an item of s is equal to x, else False
and "equal to" means == is true.