Membership tests without cross-type comparisons

Override ``__contains__`` so we can check membership without triggering the cross-type comparison warnings.

/review @adepue