Raymond Hettinger
e76816b146
Fix typo.
2009-01-29 03:43:44 +00:00
Raymond Hettinger
36d816b0ab
Update itertools.__doc__ to include all tools.
2009-01-29 03:21:42 +00:00
Raymond Hettinger
d081abc8be
Promote combinations_with_replacement() from a recipe to a regular itertool.
2009-01-27 02:58:49 +00:00
Raymond Hettinger
2bcb8e9b0d
Promote compress() from a recipe to being a regular itertool.
2009-01-25 21:04:14 +00:00
Amaury Forgeot d'Arc
a40d573664
#3720 : Interpreter crashes when an evil iterator removes its own next function.
...
Now the slot is filled with a function that always raises.
Will not backport: extensions compiled with 2.6.x would not run on 2.6.0.
2009-01-12 23:36:55 +00:00
Raymond Hettinger
5b913e31a1
Forward port r68394 for issue 4816.
2009-01-08 06:39:04 +00:00
Georg Brandl
8550d69a84
#2536 : fix itertools.permutations and itertools.combinations docstrings.
2008-06-10 12:46:39 +00:00
Gregory P. Smith
dd96db63f6
This reverts r63675 based on the discussion in this thread:
...
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes
593daf545b
Renamed PyString to PyBytes
2008-05-26 12:51:38 +00:00
Raymond Hettinger
0ccfe5f2a0
Remove itertools warnings I had added before the 2-to-3 handled the migration.
2008-03-19 18:01:58 +00:00
Raymond Hettinger
10dca6e282
The filter() function does support a None argument in Py3.0.
2008-03-19 17:58:59 +00:00
David Wolever
2724ab99c8
Added zip, map, filter to future_bultins ( #2171 )
2008-03-19 02:35:45 +00:00
Raymond Hettinger
431f029486
Consistent tense.
2008-03-13 16:43:59 +00:00
Raymond Hettinger
10f40a6b5a
Add 2-to-3 support for the itertools moved to builtins or renamed.
2008-03-13 16:43:17 +00:00
Raymond Hettinger
a1ca94a102
Issue 2246: itertools grouper object did not participate in GC (should be backported).
2008-03-06 22:51:36 +00:00
Raymond Hettinger
6e3e415886
Small code cleanup.
2008-03-05 21:04:32 +00:00
Raymond Hettinger
66f91ea966
C implementation of itertools.permutations().
2008-03-05 20:59:58 +00:00
Raymond Hettinger
f1cca2b593
Fix refleak in chain().
2008-03-04 22:29:44 +00:00
Raymond Hettinger
d553d856e7
Beef-up docs and tests for itertools. Fix-up end-case for product().
2008-03-04 04:17:08 +00:00
Raymond Hettinger
e3fabd10cb
Handle 0-tuples which can be singletons.
2008-03-02 12:02:19 +00:00
Raymond Hettinger
61024b9181
Simplify code for itertools.product().
2008-03-02 11:57:16 +00:00
Raymond Hettinger
08ff6822cc
Handle the repeat keyword argument for itertools.product().
2008-02-29 02:21:48 +00:00
Raymond Hettinger
b4cbc98c39
Add alternate constructor for itertools.chain().
2008-02-28 22:46:41 +00:00
Raymond Hettinger
05bf6338b8
Have itertools.chain() consume its inputs lazily instead of building a tuple of iterators at the outset.
2008-02-28 22:30:42 +00:00
Christian Heimes
cdddf18768
The empty tuple is usually a singleton with a much higher refcnt than 1
2008-02-28 11:18:49 +00:00
Raymond Hettinger
3bd771263d
One too many decrefs.
2008-02-27 01:08:04 +00:00
Raymond Hettinger
93e804da9c
Add itertools.combinations().
2008-02-26 23:40:50 +00:00
Facundo Batista
b1d70e2252
Coerced PyBool_Type to be able to compare it.
2008-02-25 23:46:02 +00:00
Raymond Hettinger
9d63837e9b
Make sure the itertools filter functions give the same performance for func=bool as func=None.
2008-02-25 22:42:32 +00:00
Raymond Hettinger
532316dfa6
Add more comments
2008-02-23 04:03:50 +00:00
Raymond Hettinger
73d7963242
Improve the implementation of itertools.product()
...
* Fix-up issues pointed-out by Neal Norwitz.
* Add extensive comments.
* The lz->result variable is now a tuple instead of a list.
* Use fast macro getitem/setitem calls so most code is in-line.
* Re-use the result tuple if available (modify in-place instead of copy).
2008-02-23 02:20:41 +00:00
Raymond Hettinger
50986cc45b
First draft for itertools.product(). Docs and other updates forthcoming.
2008-02-22 03:16:42 +00:00
Raymond Hettinger
473170908e
Make starmap() match its pure python definition and accept any itertable input (not just tuples).
2008-01-17 03:02:14 +00:00
Christian Heimes
e93237dfcc
#1629 : Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.
2007-12-19 02:37:44 +00:00
Raymond Hettinger
50e90e265f
itertools.count() no longer limited to sys.maxint.
2007-10-04 00:20:27 +00:00
Martin v. Löwis
6819210b9e
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
...
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Kristján Valur Jónsson
f030394de3
Fix problems in x64 build that were discovered by the testsuite:
...
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn´t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
2007-05-03 20:27:03 +00:00
Raymond Hettinger
1b6ca54c44
Remove filler struct item and fix leak.
2007-02-21 17:22:05 +00:00
Raymond Hettinger
d36862cf78
Add itertools.izip_longest().
2007-02-21 05:20:38 +00:00
Raymond Hettinger
6d121f168c
Do not let overflows in enumerate() and count() pass silently.
2007-02-08 00:07:32 +00:00
Georg Brandl
b84c13792d
Bug #1486663 : don't reject keyword arguments for subclasses of builtin
...
types.
2007-01-21 10:28:43 +00:00
Jack Diederich
36234e8f66
* regression bug, count_next was coercing a Py_ssize_t to an unsigned Py_size_t
...
which breaks negative counts
* added test for negative numbers
will backport to 2.5.1
2006-09-21 17:50:26 +00:00
Neal Norwitz
69e8897505
Bug #1550714 : fix SystemError from itertools.tee on negative value for n.
...
Needs backport to 2.5.1 and earlier.
2006-09-02 02:58:13 +00:00
Neal Norwitz
9029b5f289
nextlink can be NULL if teedataobject_new fails, so use XINCREF.
...
Ensure that dataobj is never NULL.
Reported by Klocwork #102
2006-07-23 07:59:00 +00:00
Neal Norwitz
2f3136b8f0
Fix compiler warning (and whitespace) on Mac OS 10.4. (A lot of this code looked duplicated, I wonder if a utility function could help reduce the duplication here.)
2006-05-27 05:18:57 +00:00
Jack Diederich
6c433a91d5
use Py_ssize_t in places that may need it
2006-05-26 11:15:17 +00:00
Thomas Wouters
b3deb94dc6
Add missing PyObject_GC_Track call, causing *some* itertools.tee objects to
...
not be tracked by GC. This fixes 254 of test_generators' refleaks on my
machine, but I'm sure something else will make them come back :>
Not adding a separate test for this kind of cycle, since the existing
fib/m235 already test them in more extensive ways than any 'minimal' test
has been able to manage.
2006-04-15 22:33:13 +00:00
Thomas Wouters
19bf33bc7a
Make itertools.tee and its internal teedataobject participate in GC. This
...
alone does not solve the leak in test_generators, unfortunately, but it is
part of test_generators' problem and it does solve other cycles.
2006-03-27 21:02:13 +00:00
Martin v. Löwis
02cbf4ae4b
More unconsting.
2006-02-27 17:20:04 +00:00
Martin v. Löwis
ad0a4629be
Use Py_ssize_t for counts and sizes.
2006-02-16 14:30:23 +00:00