Issue1498370
Created on 2006-05-31 17:41 by collinwinter, last changed 2009-01-27 05:14 by rhettinger.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
better_starmap.patch
|
collinwinter,
2006-06-27 09:22
|
Improve itertools.startmap(), against r47103 |
|
|
|
msg50390 - (view) |
Author: Collin Winter (collinwinter) |
Date: 2006-05-31 17:41 |
|
As it currently stands, the iterator argument to
itertools.starmap() must yield tuples, even those any
iterable can be *-expanded in function calls. The
attached patch changes starmap()'s behaviour (as well
as docs and tests) to allow the provided iterator to
return any iterable object.
The patch is against r46582.
|
|
msg50391 - (view) |
Author: George Yoshida (quiver) |
Date: 2006-06-01 01:36 |
|
Logged In: YES
user_id=671362
|
|
msg50392 - (view) |
Author: Jack Diederich (jackdied) |
Date: 2006-06-09 20:13 |
|
Logged In: YES
user_id=591932
The patch can be simplified by always calling
PySequence_Tuple() and doing the decref instead of special
casing tuples. If you pass PySequence_Tuple() a tuple it
will incref it and hand it back to you.
|
|
msg50393 - (view) |
Author: Collin Winter (collinwinter) |
Date: 2006-06-27 09:22 |
|
Logged In: YES
user_id=1344176
I've updated the patch per jackdied's suggestion, plus
improved the test suite a bit.
The patch is now against r47103.
|
|
msg50394 - (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2006-07-17 01:00 |
|
Logged In: YES
user_id=80475
Since starmap() is documented to behave like "yield
function(*iterable.next())", I think this fixup can be
considered a bugfix. If Anthony is okay with this, it
should into Py2.5.
While Jack's suggested modification leads to a
conceptually simpler patch, I prefer an alternate version
that only calls PySequence_Tuple() if PyTuple_CheckExact()
fails. That will make sure that we don't slow down the
most common case.
Also, I prefer slightly different updates to the docs and
test suite. If Anthony approves for inclusion in Py2.5, I
will upload my own version of a patch to starmap().
|
|
msg50395 - (view) |
Author: Jack Diederich (jackdied) |
Date: 2006-07-18 03:42 |
|
Logged In: YES
user_id=591932
Raymond's intuition for bare metal is correct. My suggested
simplifaction slowed down the tuple case by most of a
percent (I benchmarked it but left it out of the comment).
Preternatural, I tell you.
|
|
msg50396 - (view) |
Author: Anthony Baxter (anthonybaxter) |
Date: 2006-07-25 07:20 |
|
Logged In: YES
user_id=29957
Hm. Making the code agree with the docs is a good plan.
Please make sure to include a very clear NEWS item.
|
|
msg80621 - (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2009-01-27 05:14 |
|
This was fixed in r60013.
|
|
| Date |
User |
Action |
Args |
| 2009-01-27 05:14:58 | rhettinger | set | status: open -> closed resolution: out of date messages:
+ msg80621 |
| 2009-01-27 03:00:49 | rhettinger | set | assignee: anthonybaxter -> rhettinger |
| 2006-05-31 17:41:09 | collinwinter | create | |
|