Add basic functional methods to standard types
Project description
Sweet Pear library
Sweet pear is a python package wich add basic functional methods to the core types of python.
This is really usefull for fast prototyping / debugging.
Usage example:
(1, 2, 3, 4).map(lambda x: x**2)
["hello", "world"].map('capitalize')
You can also is this property to access member of objects:
import numpy as np
import torch
infos = (np.array([1,2,3]), np.zeros((2,5)), torch.ones((3,4)))
infos.map('shape')
How does it works
It rely on ForbiddenFruit to patch the built in types in order to add the map
method.
The implementation is pretty straight forward and simply rely on python's map implementation.
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
sweet-pear-0.0.5.tar.gz
(1.8 kB
view hashes)
Built Distribution
Close
Hashes for sweet_pear-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ae9077a6d9a4a046154ff5c38f96e7bbf73a9f78fd1fdc2e4c46db1b15ed736 |
|
MD5 | 4cf337600259a706bfc2e92b78111ee2 |
|
BLAKE2b-256 | 308269207cbb9fcdace38fdddd3130883524f1b9c6dfeff3628b20d8835c48fe |