This special method is called when the user uses the
Python “in” or
“not in” operators to
test whether a given key value matches any of the child
objects in the skip list.
# - - - S k i p L i s t . _ _ c o n t a i n s _ _ - - -
def __contains__ ( self, key ):
"""Does self contain the given key?"""
First we call the .match() method
to tell us whether there's a matching element. Then we
convert the return values of that method to a Boolean.
#-- 1 --
try:
child = self.match ( key )
return 1
except KeyError:
return 0