Skip to main content

WITH utils

Project description

With Utils

Utils that we've used a lot at WITH.

iter

Iteration-related utils

n_grams

Provides a way to create n_grams from an iterator

from with_utils.iter import n_grams
assert list(n_grams([1, 2, 3, 4], 2)) == [(1, 2), (2, 3), (3, 4)]

return_list

Transforms an iterator into a function that returns a list.

from with_utils.iter import return_list

@return_list
def foo():
    yield 1
    yield 2
    yield 3

assert foo() == [1, 2, 3]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

with-utils-0.2.1.tar.gz (1.8 kB view hashes)

Uploaded Source

Built Distribution

with_utils-0.2.1-py3-none-any.whl (2.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page