Skip to main content

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)

Uploaded Source

Built Distribution

sweet_pear-0.0.5-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

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