On Wed, Sep 13, 2017 at 10:54 AM, Jason H email@example.com wrote:
Thanks for the insights. I don't think it would be that breaking:
def remap_map(a1, a2): if hasattr(a1, '__call__'): return map(a1, a2) elif hasattr(a2, '__call__'): return map(a2,a1) else: raise NotCallable # Exception neither is callable
I think it's better to be parsimonious and adhere to the "there is one way to do it" design principle. On the matter of style, map with a lambda is more pleasing as `(expr-x for x in iterable)` rather than `map(lambda x: expr-x, iterable)`. If you need to handle multiple iterables, they can be zip'd.
I'm rather surprised that there isn't a Iterable class which dict and list derive from. If that were added to just dict and list, I think it would cover 98% of cases, and adding Iterable would be reasonable in the remaining scenarios.
For checking, there's `collections.abc.Iterable` and neighbors that can look at the interface easily, but I don't think the C-implemented, built-in types spring from them.