Raymond Hettinger
029dba5a40
Make reversed() transparent with respect to length.
2004-02-10 09:33:39 +00:00
Raymond Hettinger
06353f76be
Let reversed() work with itself.
2004-02-08 10:49:42 +00:00
Raymond Hettinger
c058fd14a9
* Fix ref counting in extend() and extendleft().
...
* Let deques support reversed().
2004-02-07 02:45:22 +00:00
Raymond Hettinger
1021c44b41
Optimize reversed(list) using a custom iterator.
2003-11-07 15:38:09 +00:00
Raymond Hettinger
85c20a41df
Implement and apply PEP 322, reverse iteration
2003-11-06 14:06:48 +00:00
Raymond Hettinger
54a831bef7
Use PyTuple_Pack() to simplify enumerate().
2003-11-02 05:37:44 +00:00
Raymond Hettinger
e8b0f0461b
* Beefed-up tests
...
* Allow tuple re-use
* Call tp_iternext directly
2003-05-28 14:05:34 +00:00
Jeremy Hylton
fbbe34789e
Add a useful docstring to enumerate.
2003-04-21 20:26:25 +00:00
Raymond Hettinger
1da1dbf458
Renamed PyObject_GenericGetIter to PyObject_SelfIter
...
to more accurately describe what the function does.
Suggested by Thomas Wouters.
2003-03-17 19:46:11 +00:00
Raymond Hettinger
0153826964
Created PyObject_GenericGetIter().
...
Factors out the common case of returning self.
2003-03-17 08:24:35 +00:00
Guido van Rossum
ca5ed5b875
Remove the next() method -- one is supplied automatically by
...
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.
2002-07-16 21:02:42 +00:00
Martin v. Löwis
14f8b4cfcb
Patch #568124 : Add doc string macros.
2002-06-13 20:33:02 +00:00
Guido van Rossum
7dab2426ca
- New builtin function enumerate(x), from PEP 279. Example:
...
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
The argument can be an arbitrary iterable object.
2002-04-26 19:40:56 +00:00