Functional collections extension functions for Python
Project description
pyfuncol
A Python functional collections library. It extends collections built-in types with useful methods to write functional Python code. It uses Forbidden Fruit under the hood.
Installation
pip install pyfuncol
Usage
To use the methods, you just need to import pyfuncol. Some examples:
import pyfuncol
[1, 2, 3, 4].map(lambda x: x * 2).filter(lambda x: x > 4)
# [6, 8]
{1, 2, 3, 4}.map(lambda x: x * 2).filter(lambda x: x > 4)
# {6, 8}
["abc", "def", "e"].group_by(lambda s: len(s))
# {3: ["abc", "def"], 1: ["e"]}
{"a": 1, "b": 2, "c": 3}.flat_map(lambda kv: {kv[0]: kv[1] ** 2})
# {"a": 1, "b": 4, "c": 9}
API
For lists, please refer to the docs.
For dictionaries, please refer to the docs.
For sets, please refer to the docs.
For more details, please have a look at the API reference.
Documentation
See https://pyfuncol.readthedocs.io/.
Compatibility
Since it depends on Forbidden Fruit, it only works on CPython.
Contributing
See the contributing guide for detailed instructions on how to get started with the project.
License
pyfuncol is licensed under the MIT license.
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
Built Distribution
File details
Details for the file pyfuncol-1.0.tar.gz
.
File metadata
- Download URL: pyfuncol-1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2099d66a2208d236f8f1fdac257df522e50925da5edeb06c4bf02993921b884c |
|
MD5 | e88380f24aedb44c58405764e4e1b58b |
|
BLAKE2b-256 | 2f50c9960ff93fff9c82512593505ff0b378f52abb35a0ef9714e86d50116d7a |
File details
Details for the file pyfuncol-1.0-py3-none-any.whl
.
File metadata
- Download URL: pyfuncol-1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b9ccae70c0c64fe9e29fbb7d485ad85e5af430e409142139199b3763b502cea |
|
MD5 | 56c7b227c7d999666a57d7e2c5f8b8e8 |
|
BLAKE2b-256 | 005d6328032aeb9bf517256c25e3f036d13f7534af89863deb1aafda440e967f |