Commit Graph

22 Commits

Author SHA1 Message Date
Raymond Hettinger ad983e79d6 Improve the implementation of itertools.tee().
Formerly, underlying queue was implemented in terms of two lists.  The
new queue is a series of singly-linked fixed length lists.

The new implementation runs much faster, supports multi-way tees, and
allows tees of tees without additional memory costs.

The root ideas for this structure were contributed by Andrew Koenig
and Guido van Rossum.
2003-11-12 14:32:26 +00:00
Raymond Hettinger d591f666de Replace the window() example with pairwise() which demonstrates tee(). 2003-10-26 15:34:50 +00:00
Raymond Hettinger 6a5b027742 Added itertools.tee()
It works like the pure python verion except:
* it stops storing data after of the iterators gets deallocated
* the data queue is implemented with two stacks instead of one dictionary.
2003-10-24 08:45:23 +00:00
Guido van Rossum 0c9a318d64 Use 'predicate = bool' as the default predicate for ifilter[false]. 2003-10-20 17:01:07 +00:00
Raymond Hettinger dbe3d280e7 Adopt Christian Stork's suggested argument order for the logic quantifiers.
Adopt Jeremy Fincher's suggested function name, "any", instead of "some".
2003-10-05 16:47:36 +00:00
Raymond Hettinger 7e43110f34 SF 810242. Fix doubled word errors. 2003-09-22 15:00:55 +00:00
Raymond Hettinger a098b33c93 Add an example to address a common question of how to split iterators. 2003-09-08 23:58:40 +00:00
Raymond Hettinger 9e3864190c Make the derived tools amendable to cut and paste. 2003-08-25 05:06:09 +00:00
Raymond Hettinger b5a420883c Modified itertools.izip() to match the behavior of __builtin__.zip()
which can now take zero arguments.
2003-08-08 05:10:41 +00:00
Raymond Hettinger c7d7766fda Improve docs:
* Simplify the pure python examples
* Add a quantify() example
2003-08-08 02:40:28 +00:00
Raymond Hettinger 88821f7c20 Important usability fix in itertools documentation. 2003-07-22 06:33:13 +00:00
Raymond Hettinger 3567a876c7 Add take() to examples. Tighten the islice() example 2003-06-28 05:44:36 +00:00
Raymond Hettinger befa37dd05 Minor updates:
* Updated comment on design of imap()
* Added untraversed object in izip() structure
* Replaced the pairwise() example with a more general window() example
2003-06-18 19:25:37 +00:00
Raymond Hettinger 341deb74e7 The previous made the stop argument optional.
It is better to be explicit and just allow stop to be None.
2003-05-02 19:44:20 +00:00
Raymond Hettinger 14ef54cd83 SF bug #730685: itertools.islice stop argument is not optional
* itertools.islice() stop argument did not perform as documented.
* beefed-up test suite
2003-05-02 19:04:37 +00:00
Raymond Hettinger 863983e8e5 Add comment on performance.
Fix missing right parenthesis.
Add three examples.
2003-04-23 00:09:42 +00:00
Raymond Hettinger 61fe64d5de User requested changes to the itertools module.
Subsumed times() into repeat().
Added cycle() and chain().
2003-02-23 04:40:07 +00:00
Raymond Hettinger 1b18ba49ab Markup and nits. 2003-02-21 01:45:34 +00:00
Michael W. Hudson eb189934ce Fix so it compiles at least.
"make lib" takes a while, doesn't it?
2003-02-11 14:24:13 +00:00
Raymond Hettinger 60eca9331a C Code:
* Removed the ifilter flag wart by splitting it into two simpler functions.
* Fixed comment tabbing in C code.
* Factored module start-up code into a loop.

Documentation:
* Re-wrote introduction.
* Addede examples for quantifiers.
* Simplified python equivalent for islice().
* Documented split of ifilter().

Sets.py:
* Replace old ifilter() usage with new.
2003-02-09 06:40:58 +00:00
Raymond Hettinger 2012f174ea SF bug #681003: itertools issues
* Fixed typo in exception message for times()
* Filled in missing times_traverse()
* Document reasons that imap() did not adopt a None fill-in feature
* Document that count(sys.maxint) will wrap-around on overflow
* Add overflow test to islice()
* Check that starmap()'s argument returns a tuple
* Verify that imap()'s tuple re-use is safe
* Make a similar tuple re-use (with safety check) for izip()
2003-02-07 05:32:58 +00:00
Raymond Hettinger 96ef8115dd Move itertools module from the sandbox and into production. 2003-02-01 00:10:11 +00:00