Iterator class with post call filtering
Project description
The filteredIterator library implements the FilteredIterator class. This class provides a iterator wrap, which can be initialised from any other iterator, Iterable or sequence, and provides easy to use chained filtering methods
filterediterator.FilteredIterator( source iterable )
Initialises the FilteredIterator wrap around the source iterable. On it’s own there is no benefit to placing the Filter wrap around an existing iterable.
FilteredIterator.filter( predicate )
returns a modified Iterator which is filtered based on the predicate. The predicate is a callable which is passed the data item from the iterator. The item is retained in the iterator if and only if the predicate callable returns True for that item.
FilteredIterator.dropwhile( predicate )
returns a modified Iterator which is filtered based on the predicate. The predicate is a callable which is passed the data item from the iterator. The items are removed from the iterator while the predicate callable returns True. Once the predicate returns True, no future items are removed by dropwhile.
FilteredIterator.takewhile( predicate )
returns a modified Iterator which is filtered based on the predicate. The predicate is a callable which is passed the data item from the iterator. The items are retained in the iterator while the predicate callable returns True. Once the predicate returns False, the iterator Stops.
Chaining methods
All of the above methods return a FilteredIterator instance, and therefore can be chained together to create complex filters as required.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file filteredIterator-0.0.1rc1.tar.gz
.
File metadata
- Download URL: filteredIterator-0.0.1rc1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 528f70ac7096d7d6daebe787c111be9f67ce58f97febdd6645e6cde558f4cdc5 |
|
MD5 | bd1281d31eabd19f7323d979eab569fb |
|
BLAKE2b-256 | aba34b80f0ad84b66b9913abe4c11b39aa92fd268a4e909fd0d22cb7e626386c |
File details
Details for the file filteredIterator-0.0.1rc1-py2.py3-none-any.whl
.
File metadata
- Download URL: filteredIterator-0.0.1rc1-py2.py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a156a6faab75a7b12856fbd865deb91fd9d941da4a65683fd0a1b46ef3f0cdd4 |
|
MD5 | b2e32f3d399bce9dc5e074a2a533efc5 |
|
BLAKE2b-256 | 7ab8f547a1727808992ea34ae27c712d88ecaa67906a28c119488d9ccd936222 |