March 2003
Intermediate to advanced
656 pages
39h 30m
English
__contains__
__contains__(self,item)The Boolean test y
in
x calls
x
.__contains__(
y
). When
x is a sequence, __contains__ should return True when
y equals the value of an item in the
sequence. When x is a mapping, __contains__ should return True when
y equals the value of a key in the
mapping. Otherwise, __contains__ should return
False. If __contains__ is
absent, Python performs y
in
x as follows, taking
time proportional to
len(
x
):
forzinx: ify= =z: return True return False