msg94455 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2009-10-25 17:53 |
Currently, ``map(None, a)`` is recognized and converted to ``list(a)`` which is correct but quite useless. ``map(None, a, b, ...)`` is not treated specially. An approximate translation would be ``map(lambda *xs: xs, a, b, ...)`` which however doesn't take into account that the new map cuts after the shortest sequence instead of "filling up" the shorter ones with Nones. That should probably produce a warning. |
|
|
msg94456 - (view) |
Author: Florian Mayer (segfaulthunter) |
Date: 2009-10-25 18:23 |
A full fix would be list(map(fun, *zip(*itertools.zip_longest(a, b, ...)))) and if fun is None list(map(lambda *xs: xs, *zip(*itertools.zip_longest(a, b, ...)))) |
|
|
msg94513 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2009-10-26 21:30 |
Fixed in r75734. |
|
|
msg94576 - (view) |
Author: Florian Mayer (segfaulthunter) |
Date: 2009-10-27 19:52 |
I dare to disagree on this being an adequate fix. Request to reopen. |
|
|
msg94577 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2009-10-27 20:22 |
2009/10/27 Florian Mayer <report@bugs.python.org>: > > Florian Mayer <flormayer@aim.com> added the comment: > > I dare to disagree on this being an adequate fix. Request to reopen. What would you prefer? |
|
|
msg94579 - (view) |
Author: Florian Mayer (segfaulthunter) |
Date: 2009-10-27 20:43 |
At least converting map(None, a, b, ...) to map(lambda *xs: xs, a, b, ...) I can understand if you prefer not to add the itertools.zip_longest workaround, although that would be the correct translation, of course. |
|
|
msg94580 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2009-10-27 20:57 |
2009/10/27 Florian Mayer <report@bugs.python.org>: > > Florian Mayer <flormayer@aim.com> added the comment: > > At least converting > > map(None, a, b, ...) > > to > > map(lambda *xs: xs, a, b, ...) Well, since that's not always correct, we should not translate to it. |
|
|
msg94581 - (view) |
Author: Florian Mayer (segfaulthunter) |
Date: 2009-10-27 20:58 |
When could this possibly be wrong, if I may ask? |
|
|