Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Composable external iteration.

License

NotificationsYou must be signed in to change notification settings

nekitdev/iters

Repository files navigation

LicenseVersionDownloadsDiscord

DocumentationCheckTestCoverage

Composable external iteration.

If you have found yourself with acollection of some kind, and needed to performan operation on the elements of said collection, you will quickly run intoiterators.Iterators are heavily used in idiomatic Python code, so becoming familiar with them is essential.

Installing

Python 3.8 or above is required.

pip

Installing the library withpip is quite simple:

$pip install iters

Alternatively, the library can be installed from source:

$git clone https://github.com/nekitdev/iters.git$cd iters$python -m pip install.

poetry

You can additers as a dependency with the following command:

$poetry add iters

Or by directly specifying it in the configuration like so:

[tool.poetry.dependencies]iters ="^0.18.0"

Alternatively, you can add it directly from the source:

[tool.poetry.dependencies.iters]git ="https://github.com/nekitdev/iters.git"

Examples

Simple

Squaring only even numbers in some sequence:

fromitersimportiterdefis_even(value:int)->bool:returnnotvalue%2defsquare(value:int)->int:returnvalue*valuenumbers= [0,1,2,3,4,5,6,7,8,9]result=iter(numbers).filter(is_even).map(square).list()print(result)# [0, 4, 16, 36, 64]

Asynchronous

Asynchronous iteration is fully supported byiters, and its API is similar to itssynchronous counterpart.

Documentation

You can find the documentationhere.

Support

If you need support with the library, you can send anemailor refer to the officialDiscord server.

Changelog

You can find the changeloghere.

Security Policy

You can find the Security Policy ofitershere.

Contributing

If you are interested in contributing toiters, make sure to take a look at theContributing Guide, as well as theCode of Conduct.

License

iters is licensed under the MIT License terms. SeeLicense for details.


[8]ページ先頭

©2009-2025 Movatter.jp