didactic-meme / pyfuncol Goto Github PK
View Code? Open in Web Editor NEWFunctional collections extension functions for Python
Home Page: https://pyfuncol.readthedocs.io/
License: MIT License
Functional collections extension functions for Python
Home Page: https://pyfuncol.readthedocs.io/
License: MIT License
Describe the solution you'd like
We should optimise chained transformations in a similar way as what Apache Spark does: they should be lazy and re-ordered so that transformations reducing the number of elements are always executed first.
Describe the solution you'd like
List operations like lazy_map
, lazy_filter
should return generators instead of lists.
Describe alternatives you've considered
An alternative would be adding a lazy
argument to each operation, but it's less clean IMHO.
It would be great if forbiddenfruit was made optional. Since forbiddenfruit requires CPython and I think if it would be better if it could work on other versions of python.
Instead of:
import pyfuncol
my_list = [1, 2, 3]
print(my_list.map(lambda x: x * 2))
I can do:
from pyfuncol.list import *
my_list = [1, 2, 3]
print(map(my_list, lambda x: x * 2))
Maybe there can be a check to see if forbiddenfruit is installed. If it is, add all the functions to the builtin classes, otherwise do nothing.
Sorry if I misunderstand how this works.
Is your feature request related to a problem? Please describe.
Expensive computations that are repeated in a map
do not leverage the fact that we already computed once the result.
Describe the solution you'd like
We can memoize pure functions on hashable inputs with something like:
cached_f = functools.cache(f)
return [cached_f(x) for x in self]
To not restrict the library's usages, it would probably make sense to create pure_map
, pure_filter
, etc.
Describe the bug
Applying transformations on built-in subclasses, like OrderedDict, returns a plain dict.
Expected behavior
Subclasses should be preserved.
Desktop (please complete the following information):
Additional context
Could be solved by doing type(self)(...)
before returning the result.
Could be useful this link.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.