pytoolz / toolz

A functional standard library for Python.
http://toolz.readthedocs.org/
Other
4.68k stars 261 forks source link

Smarter selects and transforms #327

Open AndreaCrotti opened 8 years ago

AndreaCrotti commented 8 years ago

For Clojure there is a very nice library called Specter: https://github.com/nathanmarz/specter

which does things like select and transform, allowing to traverse and transform a nested data structure much more nicely.

I don't really see something similar in Python, but I think toolz would be a good place for it.. What do you think?

mrocklin commented 8 years ago

I agree that Specter is pretty awesome. I'd also like to see something similar in Python. I think that the project is large and self contained enough to warrant its own library, separate from toolz, though perhaps within the pytoolz organization?

AndreaCrotti commented 8 years ago

Yes sure, but it depends also how much we implement probably.

Just implementing select and transform with path selectors for example would be nice, and probably would not need to be in another project?

AndreaCrotti commented 8 years ago

FYI I started something very basic here https://github.com/AndreaCrotti/spec-py

It will certainly use toolz and I'm still not sure how close to the Clojure version makes sense to be.. Still lots to do but contributions and idea definitively welcome!

jonmoore commented 7 years ago

There is a very useful itertools.remap function in https://github.com/mahmoud/boltons, examples here.