summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* More unconsting.Martin v. Löwis2006-02-271-1/+1
|
* Use Py_ssize_t for counts and sizes.Martin v. Löwis2006-02-161-8/+8
|
* Renamed _length_cue() to __length_hint__(). See:Armin Rigo2006-02-111-2/+2
| | | | http://mail.python.org/pipermail/python-dev/2006-February/060524.html
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-1/+1
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Convert iterator __len__() methods to a private API.Raymond Hettinger2005-09-241-8/+12
|
* Disallow keyword arguments for type constructors that don't use them.Georg Brandl2005-08-261-0/+36
| | | | (fixes bug #1119418)
* Added optional None arguments to itertools.islice().Raymond Hettinger2004-12-051-14/+16
|
* some platforms still need offsetof() from structmember.hFred Drake2004-10-171-0/+1
|
* Fix and test weak referencing of itertools.tee objects.Raymond Hettinger2004-10-171-1/+6
|
* Replace structure member before decreffing.Raymond Hettinger2004-10-021-1/+3
|
* * Increase test coverage.Raymond Hettinger2004-09-281-5/+9
| | | | * Have groupby() be careful about decreffing structure members.
* SF patch #1020188: Use Py_CLEAR where necessary to avoid crashesRaymond Hettinger2004-09-011-2/+1
| | | | (Contributed by Dima Dorfman)
* Exercise Jim's VISIT macro.Raymond Hettinger2004-07-151-129/+24
|
* SF #950057: itertools.chain doesn't "process" exceptions as they occurRaymond Hettinger2004-05-081-0/+12
| | | | | | | Both cycle() and chain() were handling exceptions only when switching input sources. The patch makes the handle more immediate. Will backport.
* Change two instance of format strings for PyString_FromFormat() to use %ldBrett Cannon2004-04-131-2/+2
| | | | instead of %d .
* Provide more information representations of repeat() and count().Raymond Hettinger2004-04-081-2/+27
|
* Speedup the inner loops for dropwhile(), islice(), ifilter(), andRaymond Hettinger2004-03-171-9/+17
| | | | ifilterfalse().
* need to initialize ob_type slot at run-time, at least on cygwinSkip Montanaro2004-02-101-1/+2
|
* Give itertools.repeat() a length method.Raymond Hettinger2004-02-101-1/+14
|
* Implement itertools.groupby()Raymond Hettinger2003-12-061-1/+321
| | | | | | | Original idea by Guido van Rossum. Idea for skipable inner iterators by Raymond Hettinger. Idea for argument order and identity function default by Alex Martelli. Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger).
* Improve the implementation of itertools.tee().Raymond Hettinger2003-11-121-181/+199
| | | | | | | | | | | 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.
* Fix nits in error messages.Raymond Hettinger2003-10-281-4/+4
|
* Minor improvements to itertools.tee():Raymond Hettinger2003-10-261-9/+9
| | | | | | * tee object is no longer subclassable * independent iterators renamed to "itertools.tee_iterator" * fixed doc string typo and added entry in the module doc string
* Improvements to coding for itertools.tee():Raymond Hettinger2003-10-251-3/+26
| | | | | | | | | | | | * Add error checking code to PyList_Append() call. * Replace PyObject_CallMethod(to->outbasket, "pop", NULL) with equivalent in-line code. Inlining is important here because the search for the pop method will occur for every element returned by the iterator. * Make tee's dealloc() a little smarter. If the trailing iterator is being deallocated, then the queue data is no longer needed and can be freed.
* Added itertools.tee()Raymond Hettinger2003-10-241-0/+259
| | | | | | 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.
* For safety, replace a tuple entry before decreffing it.Raymond Hettinger2003-08-301-1/+3
|
* SF bug #793826: using itertools.izip to mutate tuplesRaymond Hettinger2003-08-291-2/+4
| | | | Avoid Armin Rigo's dastardly exercise in re-entrancy.
* Modified itertools.izip() to match the behavior of __builtin__.zip()Raymond Hettinger2003-08-081-6/+2
| | | | which can now take zero arguments.
* SF patch #770521: make itertools type declarations staticRaymond Hettinger2003-07-141-24/+24
| | | | (Contributed by Andrew I MacIntyre.)
* Minor updates:Raymond Hettinger2003-06-181-3/+13
| | | | | | * Updated comment on design of imap() * Added untraversed object in izip() structure * Replaced the pairwise() example with a more general window() example
* Add missing DECREF.Raymond Hettinger2003-06-171-1/+3
|
* PyType_GenericAlloc is inherited from object.Raymond Hettinger2003-05-231-12/+12
|
* Fixed dotted name assertion.Raymond Hettinger2003-05-221-2/+2
|
* * Added a substantial number of edge case and argument tests forRaymond Hettinger2003-05-031-0/+3
| | | | | | | the itertoolsmodule. * Taught itertools.repeat(obj, n) to treat negative repeat counts as zero. This behavior matches that for sequences and prevents infinite loops.
* The previous made the stop argument optional.Raymond Hettinger2003-05-021-2/+2
| | | | It is better to be explicit and just allow stop to be None.
* SF bug #730685: itertools.islice stop argument is not optionalRaymond Hettinger2003-05-021-13/+33
| | | | | * itertools.islice() stop argument did not perform as documented. * beefed-up test suite
* Fix docstring typoAndrew M. Kuchling2003-04-141-1/+1
|
* Renamed PyObject_GenericGetIter to PyObject_SelfIterRaymond Hettinger2003-03-171-12/+12
| | | | | | to more accurately describe what the function does. Suggested by Thomas Wouters.
* Created PyObject_GenericGetIter().Raymond Hettinger2003-03-171-96/+12
| | | | Factors out the common case of returning self.
* Several of the tools can make direct calls the inner iterators.Raymond Hettinger2003-03-011-9/+24
|
* User requested changes to the itertools module.Raymond Hettinger2003-02-231-52/+236
| | | | | Subsumed times() into repeat(). Added cycle() and chain().
* Remove unused variable.Guido van Rossum2003-02-091-1/+1
|
* C Code:Raymond Hettinger2003-02-091-124/+248
| | | | | | | | | | | | | | | * 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.
* * Eliminated tuple re-use in imap(). Doing it correctly made the codeRaymond Hettinger2003-02-071-62/+30
| | | | | too hard to read. * Simplified previous changes to izip() to make it easier to read.
* SF bug #681003: itertools issuesRaymond Hettinger2003-02-071-6/+84
| | | | | | | | | | | * 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()
* Move itertools module from the sandbox and into production.Raymond Hettinger2003-02-011-0/+1532