On Wed, Nov 28, 2018 at 4:14 PM Steven D'Aprano <[email protected]> wrote:
>
> On Wed, Nov 28, 2018 at 04:04:33PM +0100, E. Madison Bray wrote:
>
> > That effort is already mostly done and adding a helper function would
> > not have worked as users *passing* map(...) as an argument to some
> > function just expect it to work.
>
> Ah, that's what I was missing.
>
> But... surely the function will still work if they pass an opaque
> iterator *other* than map() and/or filter?
>
> it = (func(x) for x in something if condition(x))
> some_sage_function(it)

That one is admittedly tricky.  For that matter it might be nice to
have more introspection of generator expressions too, but there at
least we have .gi_code if nothing else.

But those are a far less common example in my case, whereas map() is
*everywhere* in math code :)
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to