MCPcopy Create free account
hub / github.com/EntilZha/PyFunctional / take_while

Method take_while

functional/pipeline.py:425–435  ·  view source on GitHub ↗

Take elements in the sequence until func evaluates to False, then return them. >>> seq([1, 2, 3, 4, 5, 1, 2]).take_while(lambda x: x < 3) [1, 2] :param func: truth returning function :return: elements taken until func evaluates to False

(self, func)

Source from the content-addressed store, hash-verified

423 return self._transform(transformations.take_t(n))
424
425 def take_while(self, func):
426 """
427 Take elements in the sequence until func evaluates to False, then return them.
428
429 >>> seq([1, 2, 3, 4, 5, 1, 2]).take_while(lambda x: x < 3)
430 [1, 2]
431
432 :param func: truth returning function
433 :return: elements taken until func evaluates to False
434 """
435 return self._transform(transformations.take_while_t(func))
436
437 def union(self, other):
438 """

Callers 1

test_take_whileMethod · 0.80

Calls 1

_transformMethod · 0.95

Tested by 1

test_take_whileMethod · 0.64