Title: Take while
Open Graph Title: Python itertools.takewhile
Description: Whereas Python’s islice (and Haskell’s take and drop) cut some particular number of elements from a list, the corresponding takewhile and dropwhile functions inspect the list’s values and truncate the list based on what it contains. take and takewhile are both ways of taking; drop and dropwhile are both ways of dropping. The difference is how they determine how much of the series to take or drop. Haskell also comes with a function called “span” which performs both a take and a drop at the same time.
Open Graph Description: Python’s “itertools.takewhile” = Haskell’s “takeWhile”
X: @typeclasses
Domain: typeclasses.com
| theme-color | #31365f |
| og:image | https://static.typeclasses.com/twitter-python__takewhile-98dd641089.png |
| og:type | article |
| article:tag | span |
| twitter:card | summary_large_image |
Links:
Viewport: width=device-width, initial-scale=1