How to use 'unnest list python' in Python

Every line of 'unnest list python' 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
36def _unnest(lists):
37 """
38 Used to unnest compound hypotheses. Used in Evaluator.eval only.
39 """
40 new_list = []
41 # the inner-most list should have a tuple as item 1
42 while lists and isinstance(lists[1], list):
43 new_list.insert(0, lists.pop(1))
44 lists = lists[0]
45 # grab the last one
46 new_list.insert(0, lists)
47 return new_list

Related snippets