On Thu, Nov 29, 2018 at 1:46 AM Jonathan Fine <jfine2...@gmail.com> wrote:
>
> On Wed, Nov 28, 2018 at 2:28 PM E. Madison Bray <erik.m.b...@gmail.com> wrote:
>
> > I mostly agree with the existing objections, though I have often found
> > myself wanting this too, especially now that `map` does not simply
> > return a list.  This problem alone (along with the same problem for
> > filter) has had a ridiculously outsized impact on the Python 3 porting
> > effort for SageMath, and I find it really irritating at times.
>
> I'm a mathematician, so understand your concerns. Here's what I hope
> is a helpful suggestion.
>
> Create a module, say sage.itertools that contains (not tested)
>
>    def py2map(iterable):
>         return list(map(iterable))

With the nitpick that the arguments should be (func, *iterables)
rather than just the single iterable, yes, this is a viable transition
strategy. In fact, it's very similar to what 2to3 would do, except
that 2to3 would do it at the call site. If any Py3 porting process is
being held up significantly by this, I would strongly recommend giving
2to3 an eyeball - run it on some of your code, then either accept its
changes or just learn from the diffs. It's not perfect (nothing is),
but it's a useful tool.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to