3 examples of 'python list contains' in Python

Every line of 'python list contains' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
101def __contains__(self, value):
102 return value in self._dict

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

6def rcontains(obj, seq):
7 """Act like contains, but takes reverse argument order.
9 Motivation: use it like ge, le, gt, lt etc. (aka operator(value, const))
10 """
11 return contains(seq, obj)
981def ll_listcontains(lst, obj, eqfn):
982 lng = lst.ll_length()
983 j = 0
984 while j < lng:
985 if eqfn is None:
986 if lst.ll_getitem_fast(j) == obj:
987 return True
988 else:
989 if eqfn(lst.ll_getitem_fast(j), obj):
990 return True
991 j += 1
992 return False

Related snippets