summaryrefslogtreecommitdiff
path: root/Objects/enumobject.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert iterator __len__() methods to a private API.Raymond Hettinger2005-09-241-9/+11
|
* SF patch #1020188: Use Py_CLEAR where necessary to avoid crashesRaymond Hettinger2004-09-011-4/+1
| | | | (Contributed by Dima Dorfman)
* Fix docstring typo.Raymond Hettinger2004-08-251-1/+1
|
* * Add unittests for iterators that report their lengthRaymond Hettinger2004-04-121-1/+12
| | | | | | * Document the differences between them * Fix corner cases covered by the unittests * Use Py_RETURN_NONE where possible for dictionaries
* Tidied up the implementations of reversed (including the custom onesRaymond Hettinger2004-03-101-16/+20
| | | | | | | | | | | | | | | | | for xrange and list objects). * list.__reversed__ now checks the length of the sequence object before calling PyList_GET_ITEM() because the mutable could have changed length. * all three implementations are now tranparent with respect to length and maintain the invariant len(it) == len(list(it)) even when the underlying sequence mutates. * __builtin__.reversed() now frees the underlying sequence as soon as the iterator is exhausted. * the code paths were rearranged so that the most common paths do not require a jump.
* Eliminate the double reverse option. It's only use caseRaymond Hettinger2004-03-101-13/+1
| | | | was academic and it was potentially confusing to use.
* Make reversed() transparent with respect to length.Raymond Hettinger2004-02-101-1/+13
|
* Let reversed() work with itself.Raymond Hettinger2004-02-081-1/+12
|
* * Fix ref counting in extend() and extendleft().Raymond Hettinger2004-02-071-2/+1
| | | | * Let deques support reversed().
* Optimize reversed(list) using a custom iterator.Raymond Hettinger2003-11-071-2/+2
|
* Implement and apply PEP 322, reverse iterationRaymond Hettinger2003-11-061-0/+125
|
* Use PyTuple_Pack() to simplify enumerate().Raymond Hettinger2003-11-021-5/+1
|
* * Beefed-up testsRaymond Hettinger2003-05-281-13/+42
| | | | | * Allow tuple re-use * Call tp_iternext directly
* Add a useful docstring to enumerate.Jeremy Hylton2003-04-211-1/+6
|
* Renamed PyObject_GenericGetIter to PyObject_SelfIterRaymond Hettinger2003-03-171-1/+1
| | | | | | to more accurately describe what the function does. Suggested by Thomas Wouters.
* Created PyObject_GenericGetIter().Raymond Hettinger2003-03-171-8/+1
| | | | Factors out the common case of returning self.
* Remove the next() method -- one is supplied automatically byGuido van Rossum2002-07-161-16/+11
| | | | | | | | PyType_Ready() because the tp_iternext slot is set (fortunately, because using the tp_iternext implementation for the the next() implementation is buggy). Also changed the allocation order in enum_next() so that the underlying iterator is only moved ahead when we have successfully allocated the result tuple and index.
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-2/+2
|
* - New builtin function enumerate(x), from PEP 279. Example:Guido van Rossum2002-04-261-0/+139
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object.