mila-iqia / picklable-itertools Goto Github PK
View Code? Open in Web Editor NEWitertools. But picklable.
License: MIT License
itertools. But picklable.
License: MIT License
count
cycle
repeat
chain
compress
dropwhile
groupby
ifilter
ifilterfalse
islice
imap
starmap
tee
takewhile
izip
izip_longest
product
permutations
combinations
combinations_with_replacement
accumulate
file_iterator
range_iterator
dict_iterator
ordered_sequence_iterator
Some (maybe all) of our implementations can be swapped in for faster standard library versions on Python 3. We ought to do this maybe.
Don't know how to get the badges in README.rst back to normal.
See #24
It'd be nice to have a picklable version of the equizip
operator I wrote in mila-iqia/blocks#458. For example, the Merge
transformer from mila-iqia/fuel#31 could use this (optionally, but by default) so that we can raise errors when a user is trying to zip two datastreams of different length.
Travis, maybe scrutinizer. It'll run pretty infrequently but this package is important enough for Blocks that we'd like it not to break.
Self-explanatory.
Would be great to extend this package to contain itertoolz
implementations as well. The one that I can think of that are particularly handy are partition
and partition_all
, so that returning batches becomes: partition(batch_size, xrange(num_examples))
.
rangeiterator
objects aren't picklable either, but a custom iterator should be simple enough.
@dwf Wondering if you consider this within the scope of the framework.
File handles are iterators, and they can't be pickled.
>>> f = open('README.md')
>>> f
<open file 'README.md', mode 'r' at 0x7f13b1360d20>
>>> it = iter(f)
>>> it
<open file 'README.md', mode 'r' at 0x7f13b1360d20>
>>> next(it)
'picklable_itertools\n'
>>> cPickle.dumps(it)
TypeError: can't pickle file objects
Analogously to ordered_sequence_iterator
, can I add a file_iterator
? It will be a bit more involved, because it needs to handle a variety of things through custom __getstate__
and __setstate__
methods:
a.k.a. filterfalse
https://docs.python.org/3.4/library/itertools.html#itertools.filterfalse
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.