Skip to main content

Additions to more-itertools: at_least_n() and at_most_n()

Project description

Intro

Though more-itertools contains many functions, it can never be 'complete'.

Below extensions were proposed, but not (yet) added to more-itertools. Module more-more-itertools acts as their abode until they get added to more-itertools.

Functions

at_least_n(iterable, n, too_short=None)

Validate that iterable has at least n items and return them if it does. If it has fewer than n items, call function too_short with its item-count.

Suggested for addition to more-itertools as #1053 on 9 Aug 2025.

at_most_n(iterable, n, too_long=None)

Validate that iterable has at most n items and return them if it does. If it has more than n items, call function too_long with the number n + 1.

Suggested for addition to more-itertools as #1053 on 9 Aug 2025.

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

more_more_itertools-0.1.20250811.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file more_more_itertools-0.1.20250811.tar.gz.

File metadata

File hashes

Hashes for more_more_itertools-0.1.20250811.tar.gz
Algorithm Hash digest
SHA256 e1c35df5b840e63fd4a4e7884b1a6ecb4e002d0616568ac84f20238f01faa1c1
MD5 d43c9dd3db0807931bd4d3be9d812dd9
BLAKE2b-256 254d2abc5471d44d7b6dffcc1b3259b43098ae817400bd1bd75003faf9d28dd0

See more details on using hashes here.

Supported by

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